Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Using split

by tachyon (Chancellor)
on Mar 07, 2003 at 12:10 UTC ( [id://241116]=note: print w/replies, xml ) Need Help??


in reply to Using split

This is a very common Perl idiom that lets you toss stuff caught in regex matches into lists. Note you need list context so the () around $filename are required for $1 to be assigned to it correctly.

($filename) = '/path/to/file.name' =~ m!([^/]+)$/;

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found