Home  |  Linux  | Mysql  | PHP  | XML
From:David Nicol Date:Thu Sep 25 14:08:21 2008
Subject:Re: Interpolated code blocks may not create lexicals
On 9/25/08, Eirik Berg Hanssen <Eirik-Berg.Hanssen@allverden.no> wrote:
>  print <<STR;
>  I like @{
>      my $rand = rand();
>      [$rand < 0.5 ? 'pie' : 'beer']
>  }
>  STR
>
>
>   You already have a block; no need for a do-block within it.
>
>
>   (The rest, others already covered.)

the "fun with perl" mailing list doesn't still exist, does it?

there's also

   	my $BeerOrPie;
 	sub BeerOrPie::TIESCALAR { bless \(my $x), 'BeerOrPie' };
 	sub BeerOrPie::FETCH { rand() < 0.5 ? 'pie' : 'beer'; };
 	tie $BeerOrPie, 'BeerOrPie';
        print "I like $BeerOrPie\n";

-- 
"checks and balances" is not financial jargon
Navigate in group perl.fwp at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants