Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 scrutinizing the Monastery: (8)
As of 2015-08-01 01:39 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 (285 votes), past polls