if ( @ARGV ) { my $file = shift(@ARGV); open(my $fh, "> $file") or die("Unable to open output file \"$file\": $!\n"); select($fh); } print "this is a test\n";