http://qs321.pair.com?node_id=663969


in reply to Re^2: regexp list return 5.6 vs 5.8
in thread regexp list return 5.6 vs 5.8

Really, I too was surprised. Changing sub test to

sub test { my @rv = $_[0] =~ /^([0-9]+)$/; print "<<@rv>>\n"; return @rv[ 0 .. $#rv ]; }
produced
<<>> [[] <<>> [] <<123>> [123] <<123>> [123]
changing sub test to
sub test { my @rv = $_[0] =~ /^([0-9]+)$/; print "<<@rv>>\n"; return wantarray? @rv: $rv[-1]; }
produces
michael$ perl t.pl <<>> Use of uninitialized value in print at t.pl line 5. [] <<>> [] <<123>> [123] <<123>> [123]
Note the warning. (And I suspect there are some monks who are now saying I told you so;-)