Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Referencing the locals

by 1nickt (Canon)
on Apr 28, 2021 at 18:24 UTC ( [id://11131805]=note: print w/replies, xml ) Need Help??


in reply to Referencing the locals

Hi. First, use strict and warnings and see what happens, then never turn them off again.

Second, don't use "a" or "b" as variable names. They are special.

For your stated objective:

my @cat=(1,2,3); my @dog=(5,6); my @pig=(4,3,2,1); for(\@cat,\@dog,\@pig){ stuff($_); # stuff() gets an arrayref and will need to dereference + it }

Hope this helps!


The way forward always starts with a minimal test.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found