in reply to a lil help on file extension

Try this on for size: if ( $file_names !~ /\.html?/ ) {

Oh and you might want to anchor that at the end like this: if ( $file_names !~ /\.html?$/ ) {

By the way, using !~ means that you are checking that it doesn't match. If you want to look for matches use =~ instead.