in reply to verifying user input with Find::File
but i think youd be better off looking at File::Find and maybe File::Basename and maybe even use Cwd as well. that way if you decide to ever take the script further than just testing for if file or dir, then you will have everything set and ready to go.use File::Slurp; my @dir_contents = read_dir($argv[0]); for my $entry(@dir_contents){ if (-d $entry){ print $entry is a directory"; } elsif (-f $entry){ print $entry is a file"; } else { print "not a directory or file <.<"; } }
|
|---|