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

Re: regular expressions on the basis of suffix

by i5513 (Pilgrim)
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

Replies are listed 'Best First'.
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-06-23 06:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (536 votes). Check out past polls.