Peter Scott wrote:
>
> At 01:15 PM 2/15/01 -0500, John Porter wrote:
> > > my $a, $b, $c; # only $a is lexically scoped
>
> Quite. But on a tangent, I see no good reason why this shouldn't be given
> the same interpretation as "my ($a, $b, $c)" on the grounds that functions
> taking list arguments that omit their parentheses swallow up the following
> list. And if the retort is, "my isn't a function," then I would like to
> know what it really is and why it's listed in perlfunc along with other
> things that aren't functions.
I agree with this statement. Perhaps someone who was around during the
initial 'my' discussions can shed some light on why it binds so tightly.
I have observed you can do something like this:
my $OUTER = '';
if ( $some_value ) {
# 'my' only on the first one
(my $inner, $OUTER) = split;
# more code that uses $inner ...
}
if ( $OUTER ) {
# $inner not here, but that's fine...
}
But I have never found a situation where this is so useful to justify
the other problems it creates. However, there may well be true technical
reasons why "my $x, $y, $z" does not do what many think it should.
Also, as the author of RFC 64, let me say that while I think it's cute
and nifty, I think it's also true from the discussions that it causes
far more problems than it solves. I no longer think it's a good idea, at
least not in its current incantation. There may be other ways to
approach it, but I can't think of any that aren't more complex than (a
possibly modified) "my".
-Nate