in reply to Arrays and Lists

Hmm. You aren't putting a filehandle read operation (not a filehandle) in a list context. You're putting it into a scalar context. Notice:
$a = THIS_IS_IN_SCALAR; $a = (THIS_IS_STILL_IN_SCALAR); @b = THIS_IS_IN_LIST; @b = (THIS_IS_STILL_IN_LIST);
It's not the presence of parens on the right that matters. It's the context of the assignment operator, which is determined by the type of the object on the left side.

And a filehandle read in a scalar context returns one item. If there had been a comma on the right, as in:

$a = ($x, $y, <DATA>);
then it still would have been in scalar context, reading only one item. Because now we have a comma (sequential expression evaluation) operator, not a list-building comma.

This is perhaps not intuitive on first cut, but it's entirely consistent with reading the operations "from outside in", and knowing that parens aren't really doing anything here but providing precedence management.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
RE: RE: Arrays and Lists
by princepawn (Parson) on Aug 07, 2000 at 22:53 UTC
    So it seems that commas can be list-building ops or sequential expression evaluation ops. And it seems that parentheses can be list constructors or explicit precedence controllers.