edimusrex has asked for the wisdom of the Perl Monks concerning the following question:
My issue should be simple but it's driving me crazy. What I am doing is trying to verify whether or not a folder path exists by reading a users input. Here is what I have now but it returns nothing
print "What do you want to save?\n"; my $inp = <>; $inp =~ s/\\/\//g; if ($inp !~ m/^\w+$|^.+$/g) { do { print "Nothing Entered. Try Again - "; $inp = <>; } until ($inp =~ m/^\w+$|^.+$/g) } if ( -d $inp) { print "Folder exists! - \n" }
I eventually would like to verify a file but for now the directory is all I need. Any help would be appreciated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Verifying If a directory exists
by moritz (Cardinal) on Feb 23, 2012 at 17:43 UTC | |
by edimusrex (Monk) on Feb 23, 2012 at 18:15 UTC | |
|
Re: Verifying If a directory exists
by Marshall (Canon) on Feb 23, 2012 at 18:20 UTC | |
|
Re: Verifying If a directory exists
by JavaFan (Canon) on Feb 23, 2012 at 20:13 UTC |