perl - Accessing and printing Hash of array -
i have question of how print hash:
@language(1,2,3); $i (0 .. $#language) { $statement = $db->selectall_arrayref( "select word words left outer join language on words.languageid = language.languageid words.languageid = $language;" ); %words=((@language[$language])=> {@$statement}); } return %words;
how can print out hash
i tried this:
foreach $key(keys %newwordslist) { print "dozzzz: " . $key . "\n"; $ind(0 .. @{$newwordslist{$key}}-1){ print $newwordslist{$key}[$ind] . "\n"; } }
but nothing.
and have question: hash sequential order or not mean $key
, because try yo print $keys
supposed print 123
prints out 132
what wrong?
hash tables don't preserve insertion order. you'll need use different data structure, perhaps tie::ixhash.
Comments
Post a Comment