title: Print current directory using Perl
body: <p>I have this code to print the current directory using Perl:</p>
  
  <pre><code>use Cwd qw(abs_path);
  my $path = abs_path($0);
  print "$path\n";
  </code></pre>
  
  <p>But it is displaying the filename of my script along with the directory. </p>
  
  <p>Like this:</p>
  
  <blockquote>
    <p>C:\Perl\duration.pl</p>
  </blockquote>
  
  <p>I want it only to display <code>C:\Perl\</code>.</p>
  
  <p>How can I do it?</p>