Johan Vromans wrote:
> 
> What would be the semantics if 'my' were left out? Would it be
> equivalent to:
> 
>     sub whois ($) {
>         local($user) = @_;
>     }

No. I'd say it should inherit the default global scope. This is
*consistent* within Perl. Here's the choices as I see it:

   1. Do lots of auto-scoping behind the scenes.
   2. Do none. Make the user use my(). 

However, I don't see this as a valid option:

   3. Mostly none. Just a few exceptions, here and there.

I've heard "internal consistency" bandied about a lot. I think
auto-my()ing variables in these sub declarations is a bad idea.

What if you DON'T want them to be my()'ed? Do we have to add a global()
keyword?

   sub make_it_so ($WARP) {
       # ... does something ...
   }

   make_it_so(9);
   print "Now travelling at warp $WARP\n";

Ugly? Maybe. But consistent with Perl. Same as this:

   sub make_it_so {
       $WARP = shift;
   }
    
   make_it_so(9);
   print "Now travelling at warp $WARP\n";

-Nate

Reply via email to