I have the following set of aarays:
@lane01_1= (200900..202543); @lane01_2= (202544..204187); @lane01_3= (204188..205831); @lane01_4= (205832..207475); @lane01_5= (207476..210119); @lane01_6= (210120..211763); @lane01_7= (211764..213407); @lane01_8= (213408..215051);
Now I have a log file which is parsed for a certain number which I store in a variable $vector. Now if $vector matches any of the elements in @lane01_1 I need to print "1", If it matches the elements in @lane01_2, I need to print "2" and so on and so forth. Whats the best way to do this? Should I push these arrays in to a hash (and whats the easiest way to do that?) or can I do it without using a hash? Thanks!!

In reply to match with elements in array by finder003

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.