Re: Usenix BOF anyone

[email protected] (Peter Scott)
Newsgroups perl.trainers
Message-ID <[email protected]>
At 04:17 PM 3/31/00 -0700, Joseph N. Hall wrote:
>* ObPerl: How to explain to a class of complete novices why parens are needed
>* in my ($x, $y); but if you follow a general rule of "put parens in
>* everywhere until you figure out where you can leave them out" you get
>* benign warnings "foo(...) interpreted as function"...
>
>Because my acts as a "list modifier."  The semantics are the same whether
>or not you have the my:
>
>   $a, $b = $x, $y;      # not too good
>   my $a, $b = $x, $y;   # not too good either
>
>   ($a, $b) = ($x, $y);
>   my ($a, $b) = ($x, $y);
>
>No matter what you do, the = operator always has higher precedence
>than the comma operator.  Whether there's a my involved doesn't affect
>that.

Yes, but I was talking about the case where there is no assignment, just

         my ($x, $y);

Novice sees this and thinks, "Those parens must be unnecessary for the same 
reason that they are in "print (args);", no?  Is 'my' a function?... 
(checks perlfunc, there it is)... okay" (boom, subtle error).



--
Peter Scott
Pacific Systems Design Technologies
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.