![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
"Scalar found where operator expected", referencesby jjohhn (Scribe) |
on May 21, 2005 at 23:15 UTC ( #459286=perlquestion: print w/replies, xml ) | Need Help?? |
jjohhn has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a subroutine that chooses a random key from a hash, but the choice is weighted depending on the value of the hash. The keys are a list of words from a text, the values are the frequency of occurence. (This is from the online book "Learning Perl the Hard Way" http://greenteapress.com/perl/) anyway I don't understand the syntax error being flagged: update: changed push @weighted $hash{$key); to push @weighted $key;error still there
Back to
Seekers of Perl Wisdom
|
|