http://www.perlmonks.org?node_id=729061


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.