First of all, use
use strict; use warnings;
Hashes can't contain arrays, just scalars. References are scalars, though, so the trick is to place references to arrays in the hash.
$fruit{0}{'fruit'} = \@fruit; # my @HoldArray = @{ $fruit{0}{'fruit'} }; # Wasteful copying my $HoldArray = $fruit{0}{'fruit'}; push @$HoldArray, $new_fruit;
etc
In reply to Re: Array in a Hash
by ikegami
in thread Array in a Hash
by g_speran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |