Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Test if a string is a sub name

by choroba (Cardinal)
on Oct 06, 2022 at 15:22 UTC ( #11147274=note: print w/replies, xml ) Need Help??

in reply to Re^2: Test if a string is a sub name
in thread Test if a string is a sub name

It seems the documentation uses the term "subroutine name" in quite a confusing way. Check the examples:
Use of a subroutine call, rather than a subroutine name, as an argument to exists is an error.
exists ⊂ # OK exists &sub(); # Error

So, in this context, "subroutine name" includes the ampersand.

Considering strict, note the exceptions to strict 'refs':

$bar = \&{'foo'}; &$bar;
We are not calling the subroutine, we're just checking it exists/is defined.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147274]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2023-03-21 15:34 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.