in reply to Getting the value out a hash

If you run your program under use strict; you get an error for my $fsize = $count; because $count was not pre-declared with my.

You did say

while (my($word, $count) = $sth->fetchrow_array) { $tag{$word} = $count; }
but that lexical $count variable has gone out of scope when the while loop finished.

Most probably you meant to say:

foreach my $words (sort keys %tag) { my $fsize = $tag{$words}; printf "<style=\"font-size:%dpx;\">%s\n", $fsize, $words; }

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James