Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: regex needed

by CukiMnstr (Deacon)
on Mar 14, 2003 at 14:27 UTC ( [id://243055]=note: print w/replies, xml ) Need Help??


in reply to regex needed

You don't need a regex for that... if you only want the second field in the string,

my $foo = (split ':', $string)[1];
will do the trick.
split() returns a list, so you can explicitely set a list context and only keep the element you want with a subscript.

hope this helps,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-16 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found