Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: regular expressions on the basis of suffix

by i5513 (Monk)
on Jul 23, 2012 at 12:31 UTC ( #983164=note: print w/ replies, xml ) Need Help??


in reply to regular expressions on the basis of suffix

If your data is homogeneous, you can use split, if you want, as alternative to regex (use undef to discard the values that are not interesting for you):

my (undef,undef,undef,$val,undef,undef)=split /\s/,"28504 0 abc 148782859 42 101M";

$val have the value that you need in this example


Comment on Re: regular expressions on the basis of suffix
Download Code
Re^2: regular expressions on the basis of suffix
by grizzley (Chaplain) on Jul 23, 2012 at 13:17 UTC

    Or just the number you need:

    my $var = (split /\s/,"28504 0 abc 148782859 42 101M")[3]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2014-04-16 14:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (430 votes), past polls