use File::Basename ("fileparse", "basename");
Now define the two given subroutines from the module, leaving your
own dirname alone. Of course, this is awkward to
type, so more often you'll see this written as:
use File::Basename qw( fileparse basename );