in reply to Verifying If a directory exists

Another way of writing the command loop...
If the user doesn't enter a non-blank line, then just a simple reprompt is usually sufficient - they figure out why you are asking the question again very quickly! Also as a general rule for the command line, leading and trailing white space is allowed.
#!/usr/bin/perl -w use strict; while ( (print "Enter Directory for saving: "), my $input = <STDIN> ) { next if $input =~ /^\s*$/; # simple reprompt if blank line $input =~ s/^\s*//; # trim leading blanks $input =~ s/\s*$//; # trim trailing blanks # also does an implicit "chomp" if (-d $input) { print "DirectoryPath: $input already exists!\n"; next; #this causes a reprompt.. } print "processing directory $input\n"; last; }