Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to I check if a value is present in an array?

by tobyink (Abbot)
on Aug 03, 2013 at 14:48 UTC ( #1047712=note: print w/ replies, xml ) Need Help??


in reply to How to I check if a value is present in an array?

Why do you persist in using two arrays when virtually all the answers in your previous thread (A better way to make the script run faster?) advised you to use a hash, which would make your script at least an order of magnitude faster.

Anyway, you want something like:

grep($genes[$index] eq $_, @gl)

The first argument to grep is an expression or a block which is expected to return true or false.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: How to I check if a value is present in an array?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (13)
As of 2015-07-02 09:55 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 (33 votes), past polls