use strict; use warnings; my $path='/home/something/something/something'; if ( -d "$path/BUS" ) { opendir my $VEH, "$path/BUS" or die"couldnt open the directory\n"; while(readdir $VEH ) { print "$_\n"; } }