a quick explanation wouldn't go amiss...
Here's an explanation of what davorg suggested...
First, let's look at your data. The
line 'push @array, \%data;' in your code
builds an array of references to hashes. You might picture
the contents of @array as looking a little like this:
(hashref1, hashref2, hashref3, hashref4, etc.)
So... davorg's line of code (reading it right to left) says:
for each value in @array...
(and we know those values are hash references)
dereference each hashref...
(using the $hashref->{key} syntax)
to give us the value associated with the ID key.
If that value taken as a number...
(otherwise you would want to use 'eq' instead of '==')
equals the value of $id...
'pass it through' to be included in @wanted.
HTH |