Following up from here: Perl Imgsize not working in loop? I have another question - how do I not let perl list the single and double dot entries when it reads the files in a dir
I'm going to suggest something else - don't use readdir and instead use glob.
my @dirlist = glob ( "$dir/*.jpg" );
And then you'll get a list of paths to files matching that spec. This is particularly useful if you're doing:
foreach my $file ( glob ( "/path/to/file/*.jpg" ) ) {
open ( my $input, '<', $file ) or die $!;
}
Where with readdir you'll only get a filename, and have to reconstruct the path yourself.