The first time <> is evaluated, the @ARGV array is checked, and if it is empty, $ARGV[0] is set to "-", which when opened gives you standard input. The @ARGV array is then processed as a list of filenames.So if there is nothing in @ARGV to begin with, it will read from STDIN. But as it reads from @ARGV, it unshifts the files from the array. So when the loop ends, $#ARGV = 0. But...
The <> symbol will return undef for end-of-file only once. If you call it again after this, it will assume you are processing another @ARGV list, and if you haven't set @ARGV, will read input from STDIN.So it will return false once and then begin to read from STDIN.
In reply to Re: Re: Re: Re: Reading from STDIN
by jweed
in thread Reading from STDIN
by unstable_geek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |