No, that would be very, very bad. That would disable you
to write functions "the Perl" way, that is, when given
no arguments, they act on $_.
Besides, from the language aspect, there is no such thing
as a "module scope".
Abigail | [reply] [d/l] |
I did not say that it should be mandatorily localized. What I meant was to localize it by default, and when the author wants there should be a language construct to override that behaviour.
| [reply] |
It's discussed in Apocalypse 6, though lore had it that $_ would indeed be lexically scoped to each sub.
Furthermore, a method will see $_ as "this" upon entry, so it will almost never work the old way (sorry, Abigail-II).
Page 9 shows "Your caller's current topic is named $CALLER::_." and goes on to illustrate how to use it as a default parameter, so if you call it without an argument the function uses the caller's $_. But the function can call it by whatever formal name it likes for that parameter.
| [reply] |