Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: extract file name from a dynamic path

by harleypig (Monk)
on Sep 06, 2008 at 17:34 UTC ( [id://709534]=note: print w/replies, xml ) Need Help??


in reply to extract file name from a dynamic path

I would agree with the response above. Use File::Basename. It handles a lot of things you wouldn't necessarily think to include.

However, for the sake of completeness, there are a couple of ways you could do this:

( $filename ) = $tst =~ /^.*\\(.*)$/

$filename = ( split /\\/, $tst )[-1]

Harley J Pig

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2024-03-28 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found