if ($file !~ /$ext/) { ..do something if $file does not contain $ext.. }