in reply to Why am I getting Can't use string (<string value>) as an ARRAY ref wile "strict refs" in use
Maybe you should consider using a hashtable to store the information you parse out from each line of your input, e.g.:
mtab[$ii] = { 'product' => $product, 'date' => $date, 'hour' => $hour, ... };# I am a hash(ref) stored in an array
I am pretty sure that $mtab[$i][$j][$k][$l]=$user; is not doing what you have in mind - whatever that is. Be warned that Perl arrays are not sparse so if your $i,$j,$k,$l are some large-ish number then you have just created a 4-dimensional monster in RAM.
Perl arrays are not sparse. In other words, if you have a 10,000th element, you must have the 9,999 other elements, too. They may be undefined, but they still take up memory. For this reason, $array[time( )], or any other construct that uses a very large integer as an array index, is a really bad idea. Use a hash instead. (Perl Cookbook, 2nd Edition by Nathan Torkington, Tom Christiansen)
bw, bliako
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why am I getting Can't use string (<string value>) as an ARRAY ref wile "strict refs" in use
by 5NOMAD7 (Initiate) on Feb 28, 2019 at 13:31 UTC | |
by hippo (Archbishop) on Feb 28, 2019 at 14:25 UTC | |
by pryrt (Abbot) on Feb 28, 2019 at 14:25 UTC | |
by poj (Abbot) on Feb 28, 2019 at 14:26 UTC | |
by NetWallah (Canon) on Mar 01, 2019 at 00:26 UTC | |
by bliako (Abbot) on Mar 02, 2019 at 01:05 UTC |