Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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

by Aristotle (Chancellor)
on Jun 14, 2002 at 08:47 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://174434]
erix joining the EU after all

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-10-17 10:36 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (225 votes). Check out past polls.