I haven't programmed in Perl in over 10 years so maybe this is something obvious to more experienced Perl programmers. I searched for an answer but didn't find anything.
My question is: why are references to anonymous arrays scalar?
For example in the following code:
#!/usr/bin/perl
use strict;
use feature qw(say);
my @array1 = ('one');
say 'array ref 1: ' . \@array1;
my @array2 = ('one', 'two');
say 'array ref 2: ' . \@array2;
say 'array ref 3: ' . \('one');
say 'array ref 4: ' . \('one', 'two');
exit 0;
The result is:
array ref 1: ARRAY(0x1e1b1c0)
array ref 2: ARRAY(0x1e1b190)
array ref 3: SCALAR(0x1e1b280)
array ref 4: SCALAR(0x1e10c40)
Why are array ref 3 and array ref 4 scalar?