if ( -d $dirname) { print "$dirname is a directory thankyou \n"; opendir(DIR, $dirname); @filenames = readdir(DIR); blah blah blah blah blah