On Mon, 7 Aug 2000 15:47:22 -0400, Ted Ashton wrote:
>$x = 2;
>{
> $x = 1;
>}
>print "$x\n";
>But if lexicals were the default, then the same code would print
>
>2
>
>because it would be equivalent to todays:
>
>my $x = 2;
>{
> my $x = 1;
>}
>print "$x\n";
>
>Would it not?
Wow. Hold it. Some people on this list have written that they want this
to mean:
my $x = 2;
{
$x = 1;
}
print "$x\n";
which is also using lexicals, only, the scope is wide enough to include
all occurences. This makes it almost identical to global variables.
IMO this shows this "default to lexicals" isn't the ultimate solution.
--
Bart.
- Re: C<strict> as default (was... Nathan Wiger
- Re: C<strict> as default ... mjd-perl-list-language-strict
- Re: C<strict> as default (was... Nathan Wiger
- Clarification on Default Scoping (w... Nathan Wiger
- Re: Clarification on Default Sc... Mark-Jason Dominus
- Re: Clarification on Default Sc... Peter Scott
- Re: Clarification on Default Sc... mjd-perl-list-language-strict
- Re: Clarification on Default Sc... Ted Ashton
- Re: Clarification on Default Sc... Bart Lateur
- Re: Clarification on Default Sc... Ted Ashton
- Re: Clarification on Default Sc... Bart Lateur
- Re: Clarification on Default Sc... Monty Taylor
- Re: C<strict> as default (was Re: RFC ... Nathan Wiger
- Re: C<strict> as default (was Re:... Michael Stevens
- Re: C<strict> as default (was... mjd-perl-list-lang-strict
- Re: C<strict> as default ... Michael Stevens
- Re: C<strict> as default ... Peter Scott
- Re: C<strict> as default ... Peter Scott
- Re: C<strict> as default ... Johan Vromans
- Re: C<strict> as default (was... Nathan Wiger
- Re: C<strict> as default (was... Bryan C . Warnock
