in reply to syntax of multidimensional arrays and hashes
As anon monk already said, turn on warnings. He is wrong on the cause of your problem though, $tsize[$tnum] is (as you expected) the size of the array in the hash of arrays
But in the following line you write $thread[$i] which would try to access an element of the array @thread which simply doesn't exist. What you wanted to do was:for ($i=0; $i<$tsize[$tnum] ; $i++) { $tlist[$tnum][$i] = $threads{$thread}[$i];
Note that you can eliminate this loop. The following is equivalent to the two lines above
push( @{$tlist[$tnum]}, @{$threads{$thread}} );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: syntax of multidimensional arrays and hashes
by hsfrey (Beadle) on Jul 19, 2009 at 03:54 UTC | |
by jethro (Monsignor) on Jul 19, 2009 at 09:44 UTC |