hsfrey has asked for the wisdom of the Perl Monks concerning the following question:
I can access the array in the hash as an array. but not its individual elements.
I'm sure that's because I don't understand the syntax.
This code compiles without syntax errors.
Can anyone show me my mistake? Thanks.$tnum=0; foreach $thread (keys %threads) { print "\n thread for $thread, tnum=$tnum:"; #dbg print "\n\tthe array from hash=@{$threads{$thread}}"; #dbg # THE ABOVE LINE CORRECTLY PRINTS THE ELEMENTS OF THE ARRAY OF THE HAS +H $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]}}; # HERE I'M TRYING TO PRINT THE ELEMENTS ONE AT A TIME print "\n\t{threads{thread[$i]}}=${$threads{$thread[$i]}}"; # BUT THE ABOVE LINE PRINTS ONLY A NULL }
|
|---|