Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: getting in trouble avoiding global variables

by webfiend (Vicar)
on Dec 09, 2008 at 00:25 UTC ( #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
Node Status?
node history
Node Type: note [id://729061]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2019-07-18 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?