in reply to hashes - finding values
Can you show us your data, what you expect, and what you get? I don't understand what is going wrong for you. The code you show looks ok and should do what you seem to want. I wonder if you have some references or something in your data which have a stringification you don't expect.
Your code can be simplified with slice initialization and grep:
That kind of construction treats the arrays and hashes as distinct objects rather than piles of data.my (%hash, @new_array); @hash{@numbers} = @values; @new_array = grep {exists $hash{$_}} @array; print @new_array;
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: hashes - finding values
by Anonymous Monk on Jul 03, 2003 at 13:59 UTC | |
by Zaxo (Archbishop) on Jul 03, 2003 at 14:29 UTC | |
by BrowserUk (Patriarch) on Jul 03, 2003 at 14:35 UTC |