Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Range Issue with RegEx

by VSarkiss (Monsignor)
on Jul 10, 2006 at 15:59 UTC ( #560173=note: print w/ replies, xml ) Need Help??


in reply to Range Issue with RegEx

As above, I'd recommend using number equality instead of regular expressions if that's what you really mean. The range operator and grep are handy for this, like in this (untested) snippet:

while (<DATA>){ chomp; $tag = $_; if (grep {$tag == $_} 500..503,531,532) { print "$tag\n"; } }
(Remember that the $_ in the grep expression is not the same as the $_ in the while loop. More info at grep.)


Comment on Re: Range Issue with RegEx
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2014-09-18 03:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (105 votes), past polls