Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

(smitz)Re: Extracting filename from a path string

by smitz (Chaplain)
on Apr 20, 2002 at 13:08 UTC ( [id://160777]=note: print w/replies, xml ) Need Help??


in reply to Extracting filename from a path string

This is tried and tested (but not v. elegant) on WinX machines:

if ($filepath =~ /([^\/\\]+)$/) { $file = $1; } else { $file = $filepath; }
where $filepath = 'c:\windows\foo\bar\quux\baz.txt'; Hope that helps,
SMiTZ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-03-29 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found