in reply to array or hash reference

Yes, you're pushing a hash reference onto @jobs.
C:\>perl -le"push @a,{};print for @a" HASH(0x2252c0) C:\>perl -le"push @a,[];print for @a" ARRAY(0x2252c0)
`perldoc perlref'

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: array or hash reference
by Anonymous Monk on Aug 11, 2004 at 07:11 UTC
    Is this statement same as
    $hash{$key} = $value; push @jobs, \$hash;
      No. Even if you wrote that correctly
      $hash{$key} = $value; push @jobs, \%hash;
      it wouldn't be the same as push @jobs, { $key, $value }; because { $key, $value} returns a reference to an anonymous hash, while \%hash returns a reference to a named hash (%hash).

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

        Actually the data in @jobs would be the same at that moment. Although %hash could be accessed/manipulated separately;

        update  as answer to davido's post here below:
        That's actuallay what I meant: pushing the hashref onto the array (as in snippet 1) lets you change the "data" of the array by changing the hash referenced.
        While pushing the hash itself onto the array (as in snippet 2) takes a copy of the content of the hash and is afterwards independant of the hash.

        pelagic