Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^3: How does 'goto LABEL' search for its label? (yow?)by tye (Sage) |
on Jan 17, 2013 at 03:01 UTC ( [id://1013687]=note: print w/replies, xml ) | Need Help?? |
I sympathized with the "yow" remark because it looked like the difference between finding the label and not finding the label was whether "return" was used. But that was a red herring. The real difference is whether the one-liner ends with "G" or with "F". The inclusion of the 'return' keyword makes no difference (but lacking the 'return' when calling "F" makes the reason for the output less obvious). Once I noticed the single-character difference off at the end of the long lines, then I lost sympathy for a "yow" response because the behavior is exactly as I would have expected from the documentation. And, it seems a reasonable restriction. Now, I think using 'goto' to leave a subroutine is a rather squirrely technique. I would much prefer that it produced a warning so you'd have to write such squirrely code more like:
Indeed, I'm not sure why the -w you used fails to trigger this:
- tye
In Section
Seekers of Perl Wisdom
|
|