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

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

Elizabeth Mattijsen
October 20, 2003 05:42
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
At 13:32 +0100 10/20/03, Nick Ing-Simmons wrote:
>Elizabeth Mattijsen <> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About