unless (caller) {
print "This is the script being executed\n";
}
See caller. It returns undef in the main script. Note that that doesn’t work inside a subroutine, only in top-level code.
unless (caller) {
print "This is the script being executed\n";
}
See caller. It returns undef in the main script. Note that that doesn’t work inside a subroutine, only in top-level code.