I am writing a perl program where I would like to separate dir names, and image files. The bit of code listed below works great for getting the dir names. Now I would like to separate files if they are images. I have struggled for two days and have not got anything to work. As a test case I am experimenting with an icon file name. Thanks for the help - JZ
opendir (DIR, "..$request_dir");
chdir "..$request_dir";
foreach (readdir DIR) {
if (-d) { push(@dir_list, $_);
} elsif ($_ =~ /(.ico$)(.png$)/i) { <--- separate out image files
push(@image_list, $_);
} else {
push(@file_list, $_);
}
}
closedir DIR;