Reini Urban schreef:
> I wonder if this strange behaviour is known:
>
> $ perl -e'my $i = 1;
> my $foo = sub {
> $i = shift if @_
> };
> print $i,&$foo(3),$i;'
> 333
>
> $ perl -e'my $i = 1;
> my $foo = sub {
> $i = shift if @_
> };
> print $i; print &$foo(3),$i;'
> 133
>
> The first seems very wrong to me.
I don't consider it wrong. Shorter:
$ perl -le'my $i = 1; print $i, $i = 3'
33
--
Affijn, Ruud
"Gewoon is een tijger."
Thread Previous
|
Thread Next