I'm using
readdir to extract the listings of the files in a directory. I would like to take the values returned and
push them onto an array. Currently the code looks like--
while ( $standir = readdir( DIR ) ) {
$type = ( -d "$path\\$standir" ) ? "dir" : "file";
if ($standir =~ m/^\./) {
$standir = '';
} else {
$standir = "$standir" ."\n";
push(@standir,$standir);
}
}
When I test the code (attempt to pop and print the contents of the array), there is nothing there. What am I missing?
Many thanks to the community.
Poetic Justice