On Sat, Jan 27, 2007 at 10:23:03AM +0100, Carl Mäsak wrote:
>  my $foo;
>  # ...later in the same scope...
>  my $foo; # illegal Perl5, legal Perl6

No, that's perfectly legal in perl5; it just generates a warning:

    use warnings;
    my $x = 1;
    my $f1 = sub { $x };
    my $x = 2;
    my $f2 = sub { $x };
    printf "f1=%d f2=%d x=%d\n", $f1->(), $f2->(), $x;

which gives

    $ perl588 /tmp/p
    "my" variable $x masks earlier declaration in same scope at /tmp/p line 6.
    f1=1 f2=2 x=2



-- 
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. -- "Bored of the Rings"

Reply via email to