http://qs321.pair.com?node_id=1080890


in reply to Arrays and Push

Well, for one thing,

$main::a = [0.25]; push @{main::hd}, [@main::a];

You never define an array @main::a (only an array ref $main::a), so that's going to push nothing. All the explicit packages make it a little harder to read, too.

And if you fix it to $main::a, it'll be pushing a ref to an array with one element, which element is an array ref, which isn't what you want either. You're kinda shotgunning syntax at the problem. What you probably want is something much simpler like

@hd = ( [] ); $a = [0.25] $b = [0.25, 0.5]; push @hd, $a; push @hd, $b;