my $file = @ARGV ? $ARGV[0] : '-'; open(IN, "< $file") or die("Unable to open input file: $!\n"); while () { print($_); # do stuff }