in reply to variable comparison
i actually use this:
my ( $name, $new_ext ) = split /./, $file;
if ( $new_ext eq $ext ) {
do something
}
but i wouldn't include the . in $ext, since it's always used for extensions. . .
Correction - this would also break on filenames like foo.bar.baz. . .