http://www.stonehenge.com/merlyn/UnixReview/col08.html
From above article, I am not fully understanding what's going on on
below code.
1)is there any difference in $next = $non_blank(<STDIN>) and
$next=$non_blank( sub{ <STDIN> }) in terms of funcaitonality?
I am not fully understanding the difference in anonymous sub vs just
having regular <STDIN> in there
2)in non_blank sub, my *guess is &{ $scanner }() is trying to
dereference the anonymous sub routine... is () necessary there?
Please kindly explain as it's bit over my head at this point but I do
enjoy the article immensenly..
thank you in advance.
$next = &non_blank(
sub { <STDIN>; }
); # read from stdin
$next = &non_blank(
sub { shift @cache; }
}; # grab from list @cache
sub non_blank {
my($scanner) = @_;
my($return);
{
$return = &{$scanner}();
last unless defined $return;
redo until $return =~ /\S/;
}
$return;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/