in reply to Deleting files of a specific extension for dir

So, where's your question?

Most likely, you want to read about the -M operator in perlop, which was mostly made for just this task.

Also, you might want to read in perlop about "Quotes and Quotelike Operators", because double quotes and backslashes together are special.

Other things to read are glob or File::Find or File::Find::Rule.