Hi all, straight out of the Learning Perl book (3rd edition, page 275)
is this code:
my @numbers;
push @numbers, split while <>;
foreach (sort { $a <=> $b } @numbers) {
printf "%20g\n", $_;
}
This works flawlessly. My question is why can't I put that variable
declaration in the push function? like this:
push my @numbers, split while <>;
foreach (sort { $a <=> $b } @numbers) {
printf "%20g\n", $_;
}
When I run this code, nothing is output. It seems I see this kind of
variable-declaration-in-a-function all the time. Why is it not
working here?
--Errin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>