Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think whether you get different behaviour depends on the exact circumstances in which the evaluation happens. I would argue that you don't see a difference, because there's nothing "on the stack" (as I hypothesized in my other reply) prior to the evaluation of the slice in scalar context. If I modify your test slightly, I do get different results depending on Perl version.
5.8.4 prints foo (and no warning), while 5.8.8 and 5.10.0 print Use of uninitialized value $s in print at -e line 1. (and no "foo"). Note 1: the sub {"foo"}->() is just a way to avoid the "Useless use of a constant in void context", which I would otherwise get when simply writing "foo", ... Note 2: Windows users will probably have to swap single and double quotes (I changed them myself in the first place, because ikegami's original version would have required additional quoting with a typical Unix shell...) In reply to Re^2: regexp list return 5.6 vs 5.8
by almut
|
|