in reply to Getting the value out a hash
You did say
but that lexical $count variable has gone out of scope when the while loop finished.while (my($word, $count) = $sth->fetchrow_array) { $tag{$word} = $count; }
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
|
|---|