I have an @array where a=stock and b=value.
a1 b1 a2 b2 a3 b3 a5 b5 a4 b4
My objective is to find the stock in the array and get its corresponding value for further printing or processing. When I use something like this:
my $stockval = grep{/a2/} @array;I get a '1' in my $stockval. I'm guessing that I'm only being told about whether a2 exists in the array or not. What should I be doing to get a2's corresponding value b2 into my $stockval? I realize that this probably a very rookie question (am new to perl). Thanks.
In reply to search and return values from an array by Gtforce
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |