Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: print to match multiple pattern

by aitap (Deacon)
on Sep 10, 2012 at 12:43 UTC ( #992747=note: print w/ replies, xml ) Need Help??


in reply to print to match multiple pattern

Don't read the whole file into memory. Read it line by line instead:

while (<FILE>) { ... # $_ is the current line }
(see Range operators).

Also, there is no need in the @t array: just slice the array returned by split:

if ((split "\t",$_)[7] =~ /^(?:HIGH|LOW|LRR)$/)

Also, your condition ($t[7] =~ /HIGH/ && /LOW/ && /LRR/) will never be true as long as one line never contains "HIGH", "LOW" and "LRR" at the same time.

Sorry if my advice was wrong.


Comment on Re: print to match multiple pattern
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-09-18 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (108 votes), past polls