in reply to Re: Arrays and Push
in thread Arrays and Push
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.
Actually,that is exactly what he wants and what both you and I have described. :) The element in the array ref is in fact a value and not another array.
$ cat pm1080886.pl #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @hd = ( [] ); my $a = [0.25]; my $b = [0.25, 0.5]; push @hd, $a; push @hd, $b; print Dumper(\@hd); exit; __END__ $ ./pm1080886.pl $VAR1 = [ [], [ '0.25' ], [ '0.25', '0.5' ] ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Arrays and Push
by fullermd (Vicar) on Apr 03, 2014 at 07:21 UTC |