Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Then I want to sort he results and insert them into some HTML and I keep getting a "Use of unitialized value in int":while (my($word, $count) = $sth->fetchrow_array) { $tag{$word} = $count; }
If I use my $fsize = $words =>$count, I get a use of unitialised value which refers to that line and it tries to put in the the key value (a word) into the place where the count goes (defined as int($fsize) in the output. I'm gradualy going spare with this and would appreciate some help and an explanation so that I can learn from it.foreach my $words (sort keys %tag) { my $fsize = $count; my $tag1 = $words => $word; printf "<style=\"font-size:%dpx;\">%s\n", int($fsize), $tag1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting the value out a hash
by Fletch (Bishop) on May 01, 2008 at 13:21 UTC | |
|
Re: Getting the value out a hash
by CountZero (Bishop) on May 01, 2008 at 13:40 UTC | |
|
Re: Getting the value out a hash
by mscharrer (Hermit) on May 01, 2008 at 13:23 UTC | |
by Anonymous Monk on May 01, 2008 at 15:41 UTC | |
|
Re: Getting the value out a hash
by MelaOS (Beadle) on May 01, 2008 at 13:18 UTC |