title: Remove file extension and path from a string in Perl
body: <p>I want to obtain a file name without its path (if it is part of the string) and also the extension.</p>
  
  <p>For example: </p>
  
  <pre><code>/path/to/file/fileName.txt     # results in "fileName"
  fileName.txt                   # results in "fileName"
  /path/to/file/file.with.periods.txt    # results in "file.with.periods" 
  </code></pre>
  
  <p>So basically, I want to remove anything before and including the last "/" if present and also the last "." along with any meta characters after it.</p>
  
  <p>Sorry for such a novice question, but I am new to perl.  </p>