Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: scope of variables in a sub

by choroba (Cardinal)
on Sep 24, 2020 at 09:40 UTC ( [id://11122153]=note: print w/replies, xml ) Need Help??


in reply to scope of variables in a sub

sub make_ap_stanza () { my $policy = $_[0];

So, you declare the subroutine with empty prototypes, i.e. as taking no parameters, but then you extract the first parameter.

See Understand why you probably don’t need prototypes.

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://11122153]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-23 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found