retrun thatroutine() if thatroutine()
That calls thatroutine() twice, which will perform things twice. Not good.
if (thatroutine()) {return $_}
$_ isn't getting set there. Are you expecting the variable to be psychic?
| [reply] [d/l] [select] |
if (thatroutine()) {return $_}
$_ isn't getting set there. Are you expecting the variable to be psychic?
No, I'm not expecting that. I tested this with a one-liner prior to posting, I swear. Problem is, I just tried re-entering that one-liner prior to posting my proof here and.... It doesn't work. I suppose I must have screwed that up somehow, the first time around. I'm not entirely clear on how $_ works.
--
Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'
| [reply] [d/l] |
$_ is set by very few things:
- An explicit assignment ($_ = 35).
- The implicit setting for a while() loop reading from a filehandle:
while (<HANDLE>) { ... } # same as ...
while (defined($_ = <HANDLE>)) { ... }
- The implicit variable of a foreach loop:
foreach (@list) { ... } # same as foreach $_ (@list) { ... }
- The implicit variable of a grep/map block (added after prodding, sorry):
$count = grep { BLOCK } LIST;
@result = grep { BLOCK } LIST;
@result = map { BLOCK } LIST;
map { BLOCK } LIST; # invalidates your warranty
I think that's it. I don't recall anything else that can set the value. Lots
of operations can alter the value, like chomp or s///.
| [reply] [d/l] [select] |