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

Re: file name parsing to get the original file name

by Abigail-II (Bishop)
on Aug 19, 2003 at 20:34 UTC ( [id://285020]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: file name parsing to get the original file name
in thread file name parsing to get the original file name

This is suboptimal. First, it isn't right on all platforms. On UNIX, a file or directory name could contain a backslash, but your regex splits on backslashes. Second, it's inefficient. If you want to take the last element of a list, take the last one, instead of first reversing the list, then putting into an anonymous array, then take the first element of that. As I indicated elsewhere in this thread:
my $file = (split m{/} => $fullpath) [-1];

Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found