The null filehandle <> is special and can be used to emulate the behav- ior of sed and awk. Input from <> comes either from standard input, or from each file listed on the command line. Here's how it works: the first time <> is evaluated, the ARGV array is checked, and if it is null, $ARGV[0] is set to '-', which when opened gives you standard input. The ARGV array is then processed as a list of filenames. The loop while (<>) { ... # code for each line } is equivalent to unshift(@ARGV, '-') if $#ARGV < $[; while ($ARGV = shift) { open(ARGV, $ARGV); while () { ... # code for each line } } except that it isn't as cumbersome to say. It really does shift array ARGV and put the current filename into variable ARGV. It also uses filehandle ARGV internally. You can modify @ARGV before the first <> as long as you leave the first filename at the beginning of the array.