Do you know where your variables are? | |
PerlMonks |
Re: Arrays and Pushby bigj (Monk) |
on Apr 03, 2014 at 05:09 UTC ( [id://1080891]=note: print w/replies, xml ) | Need Help?? |
Instead of push @{main::hd}, [@main::a];
you either wanted to write
push @{main::hd}, $main::a;
or
push @{main::hd}, [@$main::a];
If you had used use strict; use warnings Perl would have told you that @main::a is an undefined value. Only the scalar (reference to an array) $main::a is defined by you (in line 2).
Greetings,
In Section
Seekers of Perl Wisdom
|
|