Tuesday, 3 September 2019

How to get current subroutine name in Perl and ways to do it?



Method 1:
   
             print __LINE__;


Method 2:

     By Using caller() function:

              my $sub_name = (caller(0))[3];


Method 3:

     By Using Sub::Identify Module:
   
             print __SUB__ ;


kaavannan perl blogspot

Labels: ,