or download this
$dir = <>; # get directory from STDIN
chomp $dir ; # get rid of trailing new line!
...
opendir(DIR,"$dir") or die "Can't open '$dir' $!" ; # open directory $
+dir
@files = readdir(DIR); # read directory contents into @files
closedir(DIR);