Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is this the correct behaviour

16 views
Skip to first unread message

Kiran Kumar

unread,
Apr 25, 2005, 8:12:17 AM4/25/05
to perl6-c...@perl.org
Hi ,
Is this behaviour correct when i print $_ ? ..


#!/usr/bin/pugs
use v6;


for (0 .. 8) -> $tmp
{
say "tmp is $tmp \n";
}

for (0 .. 8) -> $tmp
{
say " tmp is $tmp Spcl is $_ \n";
}

Output is

tmp is 0

tmp is 1

tmp is 2

tmp is 3

tmp is 4

tmp is 5

tmp is 6

tmp is 7

tmp is 8

tmp is 0 Spcl is 1

tmp is 2 Spcl is 3

tmp is 4 Spcl is 5

tmp is 6 Spcl is 7

tmp is 8 Spcl is


~Kiran

Luke Palmer

unread,
Apr 25, 2005, 8:43:52 AM4/25/05
to Kiran Kumar, perl6-c...@perl.org
Kiran Kumar writes:
> Hi ,
> Is this behaviour correct when i print $_ ? ..
>
>
> #!/usr/bin/pugs
> use v6;
>
> for (0 .. 8) -> $tmp
> {
> say " tmp is $tmp Spcl is $_ \n";

> }
>
> tmp is 0 Spcl is 1
>
> tmp is 2 Spcl is 3
>
> tmp is 4 Spcl is 5
>
> tmp is 6 Spcl is 7
>
> tmp is 8 Spcl is

Nope. It seems that pugs is considering $tmp and the implicit usage of
$_ to specify two different parameters to the block. In fact, there's
only one: $tmp, and it is aliased to $_.

Luke

Aaron Sherman

unread,
Apr 25, 2005, 4:43:39 PM4/25/05
to Luke Palmer, Perl6 Compiler List
On Mon, 2005-04-25 at 08:43, Luke Palmer wrote:

> Nope. It seems that pugs is considering $tmp and the implicit usage of
> $_ to specify two different parameters to the block. In fact, there's
> only one: $tmp, and it is aliased to $_.

Ah, and this was my problem too. Thanks, Luke or whoever fixed this one.

--
Aaron Sherman <a...@ajs.com>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Kiran Kumar

unread,
Apr 26, 2005, 4:16:45 AM4/26/05
to Aaron Sherman, Perl6 Compiler List
I Dont think this is fixed , Im still getting this Error .

for (0 .. 8) -> $tmp
{
say " tmp is $tmp Spcl is $_ \n";
}

Aaron Sherman

unread,
Apr 26, 2005, 6:51:20 AM4/26/05
to Kiran Kumar, Perl6 Compiler List
On Tue, 2005-04-26 at 13:46 +0530, Kiran Kumar wrote:
> I Dont think this is fixed , Im still getting this Error .
>
> for (0 .. 8) -> $tmp
> {
> say " tmp is $tmp Spcl is $_ \n";
> }

Interesting. Now, it's dependent on the use of $_. Take out that $_ and
it works fine... cool bug ;-)


0 new messages