Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: extract file name from a dynamic path

by harleypig (Monk)
on Sep 06, 2008 at 17:34 UTC ( #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

Comment on Re: extract file name from a dynamic path
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2016-02-08 00:20 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (265 votes), past polls