You should really keep track of the index, not the value. But, if you really need to, this thread has some ways (although, most of them are golfed) to get an array index based on the value. So, for example, using jmcnamara's lovely sub:
use strict; my @numbers = ('0.001','0.34','0.456','0.521'); my @data = ('70.1','75.3','76.5','87.4'); print $numbers[array_index('76.5', @data)]; sub array_index { @_{@_}=-1..@_; $_{$_[0]} }
Prints 0.456

HTH

--
"I don't intend for this to take on a political tone. I'm just here for the drugs." --Nancy Reagan

In reply to Re: relating arrays by LTjake
in thread relating arrays by Anonymous Monk

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.