if(!open(OUT, ">$_")){ print "Error opening file $_ for writing: $!"; # $! holds the error mesg exit 0; }