while (my($word, $count) = $sth->fetchrow_array) { $tag{$word} = $count; } #### foreach my $words (sort keys %tag) { my $fsize = $count; my $tag1 = $words => $word; printf "%s\n", int($fsize), $tag1; }