in reply to C<while> magic also working with glob(): intentional or not?

The exact heuristics may be helpful in this meditation. Quoting from the perlop section on I/O Operators:
If what the angle brackets contain is a simple scalar variable (e.g., <$foo>), then that variable contains the name of the filehandle to input from, or its typeglob, or a reference to the same. For example:
$fh = \*STDIN; $line = <$fh>;
If what's within the angle brackets is neither a filehandle nor a simple scalar variable containing a filehandle name, typeglob, or typeglob reference, it is interpreted as a filename pattern to be globbed, and either a list of filenames or the next filename in the list is returned, depending on context. This distinction is determined on syntactic grounds alone. That means <$x> is always a readline() from an indirect handle, but <$hash{key}> is always a glob(). That's because $x is a simple scalar variable, but $hash{key} is not--it's a hash element.

One level of double-quote interpretation is done first, but you can't say <$foo> because that's an indirect filehandle as explained in the previous paragraph.

Replies are listed 'Best First'.
Re^2: C<while> magic also working with glob(): intentional or not?
by blazar (Canon) on Sep 28, 2005 at 08:05 UTC
    The exact heuristics may be helpful in this meditation. Quoting from the perlop section on I/O Operators:
    OTOH chester's observation, which comes completely unexpected to me, suggests that the observed behaviour may have little if anything to do with angular parens and thus that that heuristics may not be relevant at all.