Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: extract file name from a dynamic path

by alexm (Chaplain)
on Sep 07, 2008 at 01:41 UTC ( #709585=note: print w/ replies, xml ) Need Help??


in reply to Re: extract file name from a dynamic path
in thread extract file name from a dynamic path

While writing my last CUFP I found a warning about basename in File::Basename:

This function is provided for compatibility with the Unix shell command basename(1). It does NOT always return the file name portion of a path as you might expect. To be safe, if you want the file name portion of a path use fileparse().

I'd like to see an example of this, since I can't figure out what can be wrong with basename.


Comment on Re^2: extract file name from a dynamic path
Select or Download Code
Re^3: extract file name from a dynamic path
by Anonymous Monk on Sep 07, 2008 at 06:12 UTC
    Just keep reading, it says
    C<basename()> returns the last level of a filepath even if the last level is clearly directory. In effect, it is acting like C<pop()> for paths. This differs from C<fileparse()>'s behaviour. # Both return "bar" basename("/foo/bar"); basename("/foo/bar/");

      I was blind when I read that, thanks :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://709585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2014-04-16 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (424 votes), past polls