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
producedsub test { my @rv = $_[0] =~ /^([0-9]+)$/; print "<<@rv>>\n"; return @rv[ 0 .. $#rv ]; }
changing sub test to<<>> [[] <<>> [] <<123>> [123] <<123>> [123]
producessub test { my @rv = $_[0] =~ /^([0-9]+)$/; print "<<@rv>>\n"; return wantarray? @rv: $rv[-1]; }
Note the warning. (And I suspect there are some monks who are now saying I told you so;-)michael$ perl t.pl <<>> Use of uninitialized value in print at t.pl line 5. [] <<>> [] <<123>> [123] <<123>> [123]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: regexp list return 5.6 vs 5.8
by Sixtease (Friar) on Jan 24, 2008 at 09:50 UTC | |
by hipowls (Curate) on Jan 24, 2008 at 10:21 UTC | |
by johngg (Canon) on Jan 25, 2008 at 10:15 UTC |