Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: regular expression

by johngg (Canon)
on Feb 28, 2010 at 23:41 UTC ( [id://825788]=note: print w/replies, xml ) Need Help??


in reply to regular expression

Another way using split.

$ perl -E ' > $str = q{~/tmp/hfj/abc/bhd/5009.xmlreal.xml}; > ( $path = ( split m{/}, $str )[ -1 ] ) =~ s{^\d+}{}; > say $path;' .xmlreal.xml $

McDarren's suggestion of File::Basename is probably the safest and most portable though.

Cheers,

JohnGG

Log In?
Username:
Password:

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

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

    No recent polls found