title: How can I extract a filename from a path using Perl?
body: <p>I have a Perl variable I populate from the database. Its name is <code>$path</code>. I need to get another variable <code>$file</code> which has just the filename from the pathname. </p>
  
  <p>I tried:</p>
  
  <pre><code>$file = $path =~ s/.*\///;
  </code></pre>
  
  <p>I am very new to Perl.</p>