Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Very good points. I'll try to be more disciplined with test. What about this one:
This returns the plain list and that's what I want to mimic having it in an array. Arrays and list assignments have special meanings in scalar context. Slices do not. I don't know excactly where but it is documented. (I mean, it's documented that arrays and list assignments have the special scalar-context behavior, not that slices don't :-)) Update: From perldata: If you evaluate an array in scalar context, it returns the length of the array. (Note that this is not true of lists, which return the last value, like the C comma operator List assignment in scalar context returns the number of elements produced by the expression on the right side of the assignment: And, as you quoted from perlsub: A "return" statement may be used to exit a subroutine, optionally specifying the returned value, which will be evaluated in the appropriate context
use strict; use warnings; print "Just Another Perl Hacker\n";
In reply to Re^3: regexp list return 5.6 vs 5.8
by Sixtease
|
|