my @files = (@ARGV)?@ARGV:qw(-); NEXTFILE: while (@files) { use open ':raw'; open(ARGV, shift @files); # do sysread stuff here # don't forget that an eof here may not be a "real" eof, # but a signal to go to the next file }