Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: regex needed

by CukiMnstr (Deacon)
on Mar 14, 2003 at 14:27 UTC ( #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
Node Status?
node history
Node Type: note [id://243055]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2020-02-25 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (108 votes). Check out past polls.

    Notices?