in reply to Re: syntax of multidimensional arrays and hashes
in thread syntax of multidimensional arrays and hashes

$tsize$tnum = @{$threads{$thread}}; # number of items in the thread Ah, the beauty of Perl! It looks like nonsense, but it works <G> $threads{...} is the hash $thread is the key of the hash $threads{$thread} is the value for that key, which is an array Putting the @ in front of the array returns the size of the array. And, that's is what is correctly printed out. It's one of the FEW things I did correctly! <G>
  • Comment on Re^2: syntax of multidimensional arrays and hashes

Replies are listed 'Best First'.
Re^3: syntax of multidimensional arrays and hashes
by hsfrey (Beadle) on Jul 19, 2009 at 06:40 UTC
    VOILA! THIS WORKS!

    $tnum=0; foreach $thread (keys %threads) { $tsub[$tnum] = $thread; $tsize[$tnum] = @{$threads{$thread}}; print "\n\ttsize[tnum]= @tsize[$tnum]"; #dbg for ($i=0; $i<$tsize[$tnum] ; $i++) { $tlist[$tnum][$i] = $threads{$thread}[$i]; print "\n\t{threads{thread[$i]}}= $threads{$thread}[$i]"; print "\n\tt +list[$tnum][$i]= $tlist[$tnum][$i]"; #dbg } $tnum++; } }
    I had an extra ${...} around the assignment statement in the inner loop! Thanks to all who made suggestions! Harvey