in reply to Re: referencing hell
in thread referencing hell

Thanks for all the swift replies, I think I understand how you have done it, it certainly works, though a quick explanation wouldn't go amiss.
I will make myself more clear next time, but I wasn't quite sure what I wanted either at the time :)

Thanks again
Purge.

Replies are listed 'Best First'.
Re: referencing hell - expl of davorg's solution
by dvergin (Monsignor) on May 03, 2001 at 21:12 UTC
    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