Hi!

I don't understand why I need to use a list assignment for

  say  scalar(()=<$fh>);

but not for

  say  scalar(grep /./, <$fh>);

>From perlop:

If a <FILEHANDLE> is used in a context that is looking for a list, *a
list* comprising all input lines *is returned*, one line per list
element.

>From perlfunc:

grep EXPR, LIST

Evaluates the BLOCK or EXPR for each element of LIST (locally setting
$_ to each element) and *returns the list value*...

Thank you,
Andrey

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to