The <>
is a special case of the readline operator. It usually takes a filehandle: <$fh>
.
If the filehandle is left out, then the the magic ARGV
filehandle is used.
If no command line arguments are given, then ARGV
is STDIN
. If command line arguments are given, then ARGV
will be open
ed to each of those in turn. This is similar to
# Pseudocode
while ($ARGV = shift @ARGV) {
open ARGV, $ARGV or do{
warn "Can't open $ARGV: $!";
next;
};
while () {
...; # your code
}
}
The $ARGV
variable is real, and holds the filename of the file currently opened.
Please be aware that the two-arg form of open
(which is probably used here behind the scenes), is quite unsafe. The filename rm -rf * |
may not do what you want.