use Image::Info qw(image_info); my $width = image_info($_)->{width}; my $height = image_info($_)->{height}; print "$_\twidth = $width\theight = $height\n";