They both seem to produce the same thing:
$ref=\(1..3); will return a reference to the last thing in the list of references namely a scalar reference to 3 (as usually happens with lists on the right and scalars on the left). But then again so does
$enum_list_ref. That is
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;
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:
@a = (\1,\2,\3,\5,\6,\7,\8,\9);
the same thing would happen with
@a=(\(1,2,3),\(5,6,7,8,9)) That is:
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