there's the unix utility called basename,
And? Theres no such thing in Win32 nor a bunch of the other OS'es that Perl supports.
Im sorry to be a bit snarky, but jusitfying a feature in perl by its existance in UNIX isnt actually a very helpful argument, Perl isnt UNIX and UNIX users arent even a majority in the community anymore.
And IMO I fail to see how:
my ($vol,$path,$filename)=splitpath($spec);
is any less clear than using basename. And considering that a pathname often follows a basename id say its all the better because you get it all in one sub call. Anyway, if you feel better about having a basename sub then go right ahead, but I cant see people in p5p or Ken Williams agreeing. Hell, he even argued (and as maintainer won) that File::Spec shouldnt have a way to split arbitrary path strings properly, only one to split $ENV{PATH} itself. Which I personally thought was a pretty bad call. But whatever. :-)
---
demerphq
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|