Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Uploading Time (getting last element of a path)

by Aristotle (Chancellor)
on Jun 14, 2002 at 08:47 UTC ( [id://174434]=note: print w/replies, xml ) Need Help??


in reply to Re: Uploading Time (getting last element of a variable)
in thread Uploading Time

If one really wants to do it with a regex, a much better way would be
$fullname = "C:\\apple\\index.htm"; my ($file) = $fullname =~ m!([^/\\]+)$!; print $file;
Zero backtracking here. However, Macs are still going to be a problem (paths are separated with doublecolons there, right?), so File::Basename is what one should use.
use File::Basename; # I ain't afraid of no ghosts.. $fullname = "C:\\apple\\index.htm"; my $file = basename $fullname; print $file;
____________
Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found