in reply to How can I push a hash onto an array?
references can be simple like:
use strict; # or DIE : ) use warnings; # or SUFFER : ) my %hash = { one => 'this', two => 'that' }; my $reference = \%hash #the \ tells perl to store a reference # then you can use the reference like you would the hash by DEreferenc +ing it print "$reference->{one}"; # prints this
so in your case you would actually do sometihng like:
push @kung, \%item; print "Kungfoo is ->", $kung[0]{foo}, "<-\n";
Originally posted as a Categorized Answer.
|
|---|