I don't think the following should work, but it does:
$ perl -e '@a = qw/1222 2 3/; while (<@a>) { print $_ ."\n";}'
1222
2
3
$
As far as I know, Perl's <>
operator shoud work on filehandle, globs and so on, with the exception of the literal <>
(instead of <FILEHANDLE>
), which magically iterates over @ARGV
.
Does anyone know if it's supposed to work also as it did in my test?
Magic at work!
From 'perldoc perlop':
This is the rule you're triggering with this code. Here's what's happening: