title: How can I get the name of the current subroutine in Perl?
body: <p>In Perl we can get the name of the current package and current line number Using the predefined variables like <code>__PACKAGE__</code> and <code>__LINE__</code>.</p>
  
  <p>Like this I want to get the name of the current subroutine:</p>
  
  <pre><code>use strict;
  use warnings;
  
  print __PACKAGE__;
  sub test()
  {
      print __LINE__;
  }
  &amp;test();
  </code></pre>
  
  <p>In the above code I want to get the name of the subroutine inside the function <code>test</code>.</p>