if (open my $fo, '<', $ggg) { # Process the file. } else { # Your code to exit. } #### { print "'$ggg' is missing:\nEnsure that this file is in the working dir.\nWe are exiting.\n"; my $answer; while ('q' ne lc $answer) { print "Please press 'q' and Enter to quit\n"; chomp($answer = ); } exit; }