in reply to list references
On the other hand @a=(\(1..3),\(5..9)); will flatten the lists out before assigning to the array so you get the same thing as if you had written:use Data::Dumper; use strict; use warnings; my $ref=\(1..3); my $oth_ref = \(1,2,3); print Dumper $ref,$oth_ref __OUTPUT__ $VAR1 = \3; $VAR2 = \3;
the same thing would happen with @a=(\(1,2,3),\(5,6,7,8,9)) That is:@a = (\1,\2,\3,\5,\6,\7,\8,\9);
use Data::Dumper; use strict; use warnings; my @array = \(1 .. 3, 5 ..9); my @array2 = \(1,2,3,5,6,7,8,9); my @array3 = (\(1 ..3),\(5,6,7,8,9)); print Dumper \@array,\@array2,\@array3 __OUTPUT__ $VAR1 = [ \1, \2, \3, \5, \6, \7, \8, \9 ]; $VAR2 = [ \1, \2, \3, \5, \6, \7, \8, \9 ]; $VAR3 = [ \1, \2, \3, \5, \6, \7, \8, \9 ];
-enlil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: list references
by sleepingsquirrel (Chaplain) on Jun 15, 2004 at 23:41 UTC |