I'm having a problem that I can't figure out. Below is a snippet of my code that's not functioning the way I believe it should..
opendir (PIX_DIR, ".") or die $!;
foreach $file (readdir(PIX_DIR)) {
print "$file\n";
if ($file =~ /^\./ || $file == '') {
next;
}
print "$file\n";
}
I would expect it to display each of the filenames first unless it started with . but it's not getting to the second print statement, or anything else after that in my script. It's just spitting out each filename once, like below.
img_5870.jpg
img_5871.jpg
img_5872.jpg
img_5873.jpg
img_5874.jpg
img_5875.jpg
img_5876.jpg
Any help would be greatly appreciated. Thanks.
opendir (PIX_DIR, ".") or die $!;
foreach $file (readdir(PIX_DIR)) {
print "$file\n";
if ($file =~ /^\./ || $file == '') {
next;
}
print "$file\n";
}
I would expect it to display each of the filenames first unless it started with . but it's not getting to the second print statement, or anything else after that in my script. It's just spitting out each filename once, like below.
img_5870.jpg
img_5871.jpg
img_5872.jpg
img_5873.jpg
img_5874.jpg
img_5875.jpg
img_5876.jpg
Any help would be greatly appreciated. Thanks.