for $file (@files) { next if $file !~ /\.whatever/; do your stuff here }