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

Re: getting in trouble avoiding global variables

by webfiend (Vicar)
on Dec 09, 2008 at 00:25 UTC ( [id://729061]=note: print w/replies, xml ) Need Help??


in reply to getting in trouble avoiding global variables

Quick and dirty: Use [] to initialize an arrayref. Also, arrow notation makes most things clearer to me.

sub checkForm { my (..., $items2show_ref) = @_; $items2show_ref = []; $items2show_ref->[ARRAYX] = []; # ... push @{ $items2show_ref->[ARRAYX] }, $value; }

Good luck cleaning up the old code, by the way. That sort of pastime caused a good 50% of my gray and missing hairs.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://729061]
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: (2)
As of 2024-04-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found