develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24250] "return" required in some anonymous closures

From:
Elizabeth Mattijsen
Date:
October 20, 2003 05:42
Subject:
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
p05111b05bbb987793bed@[192.168.56.2]
At 13:32 +0100 10/20/03, Nick Ing-Simmons wrote:
>Elizabeth Mattijsen <liz@dijkmat.nl> writes:
>  >Hmmm... both of the following return correct results also:
>  >BEGIN {my $count = 'foo'}; # $foo properly initialized at compile time
>No. That has initialized a $count lexical to the BEGIN

Good point: I of course meant:

my $count;
BEGIN {$count = 'foo'}

Unfortunately, I had missed the use of printf() rather than print, so 
I also missed the format specification.  Had I changed if from %d to 
%s, then the test would have told me more (Thanks, Yves!).



Liz



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