develooper Front page | perl.perl6.language | Postings from April 2006

placeholder vs. lexical variables

Thread Next
From:
Dan Kogai
Date:
April 11, 2006 10:17
Subject:
placeholder vs. lexical variables
Message ID:
7AF9E56B-B0E0-4D21-8F2A-3172F652A6C1@dan.co.jp
Folks,

I found this when I was playing w/ pugs.

pugs> { $^x }.(42)
42
pugs> { my $z; $^x }.(42)
*** Undeclared variable: "$^x"
     at <interactive> line 1, column 10-14

So far as I see s06, there's nothing wrong w/ the statement above.  I  
just want to make sure this is not a perl6 feature.

I found this when I tried

   { my %n; { %n{ $^n } ||= ($^n <= 2 ?? 1 !!  &?BLOCK($^n-1) +  &? 
BLOCK($^n-2)) }.($^n) }.(42)

This fails on pugs while

   -> $n { my %n; { %n{ $^n } ||= ($^n <= 2 ?? 1 !!  &?BLOCK($^n-1)  
+  &?BLOCK($^n-2)) }.($n) }.(42)

beautifully returns 267914296.

Dan the Yet Another Pugs Addict


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About