This is useful if you'd rather not store a reference to the original @stationX array (note that are not these deep copies, however). Also, there is quite a bit of repetition in your code. If you're feeling adventurous, consider reducing it to:%station_data = (1, [@station1], 2, [@station2], 3, [@station3], ...
Although, the fact that you would want to consider disabling strict (ie. the fact that you have sequentially numbered variables @station(1..9)) is often indicative of a poor design choice in your code. Ask yourself how these sequential list variables got there in the first place, and how you could employ a reference-based data structure like a hash of arrays (or preferably array of arrays) from the beginning.{ no strict 'refs'; $station_data{$_} = \@{"station$_"} for 0..9; }
Additionally, read up on perlreftut, perllol, perldsc, and perlref. Teach a man to fish, ya know...
In reply to Re: %Hashing Arrays
by MeowChow
in thread %Hashing Arrays
by Pearte
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |