Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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


Comment on Re: regular expressions on the basis of suffix
Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2015-07-28 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (251 votes), past polls