Something like this basic
File::Find code should show you the right technique. Where I do the print, open and process the file.
#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
use File::Basename;
my $dir = '.';
my @files;
my @exts = qw(wbmp wmf jpeg jpe jpg ani bmp gif ico cur pcx png pnm pb
+m pgm ppm ras tga targa xbm tiff tif xpm svg svgz);
find( sub {
my $file = $File::Find::name;
my ($name, $path, $extension) = fileparse($file,'\..*');
substr $extension, 0, 1, ''; #remove leading .
if( grep {$_ eq $extension} @exts ){
print "file - $file ext = $extension\n" ;
}
}, $dir );
#print "@files\n";