title: Why is my Perl regex removing the . before the file extension?
body: <p>I have this regexp:</p>
  
  <pre><code>$f =~ s/[.\W_]//g;
  </code></pre>
  
  <p>which keeps just the numbers, letters and . in the filename (filename.ext).</p>
  
  <p>But it's not keeping the <code>.</code> (dot) before the file extension. So if I have:  </p>
  
  <pre><code>my $f = "prn-the_rush show.jpg"
  </code></pre>
  
  <p>The result is  <code>prntherushshowjpg</code>  but the <code>.</code> is missing!  </p>
  
  <p>I want <code>prntherushshow.jpg</code> as result.  </p>
  
  <p>How do I do that?</p>