use strict; use DB_File; # Hash with composite key strings: $words{category-word} gives count of # 'word' in 'category'. Tied to a DB_File to keep it persistent. my %words; tie %words, 'DB_File', 'words.db'; open( TXT, '>', 'words.txt'; while ( my ($key, $value) = each %words ) { print TXT "$key\t$value\n"; } close TXT; untie %words;