Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by choroba (Cardinal)
on Oct 06, 2022 at 15:22 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 21:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found