nationavon
MIS
The following code looks for directory names in a given directory and pushes those names onto an array. It works fine unless the directory name contains the number 1. If it contains the number 1 the name doesn't get pushed onto the array.
Nathan
### Get list of subdirectories in base directory ###
opendir(DIRHANDLE, "$b_directory" or die "$!";
while(defined($dirname = readdir(DIRHANDLE)))
{
#get rid of . and ..
next if $dirname =~ /^\.\.?$/;
#make sure we are looking at directorys
next if $dirname =~ -d "$b_directory/$dirname";
#push directory name onto and array
push(@dirs, $dirname);
}
closedir(DIRHANDLE);
Nathan
### Get list of subdirectories in base directory ###
opendir(DIRHANDLE, "$b_directory" or die "$!";
while(defined($dirname = readdir(DIRHANDLE)))
{
#get rid of . and ..
next if $dirname =~ /^\.\.?$/;
#make sure we are looking at directorys
next if $dirname =~ -d "$b_directory/$dirname";
#push directory name onto and array
push(@dirs, $dirname);
}
closedir(DIRHANDLE);