Greetings;

I keep getting a warning "Use of uninitialized value in
string ..." and I can't find a way to eliminate it.

Here is my code and the latest effort.

        foreach (<FD>) {
        chomp;
        s/^ *//;
        ($rank, $artist) = split(/ /, $_, 2);
>>      if ($name{$artist} eq "") {$cnt{$artist} = 0 ; $r{$artist} = 0 }
        $r{$artist} = $r{$artist} + $rank;
        $cnt{$artist} = $cnt{$artist} + 1;
        $name{$artist} = $artist;
        print qq($rank, $artist), "\n";
        print qq($r{$artist}, $cnt{$artist}, $name{$artist}), "\n";
        }

The line marked >> is my latest attempt at solving the
problem. While this does appear to work it still spits out a
warning message for the first record containing a different
$artist. That is what I would like to get rid of, but
programmatically, not be deleting "use warnings;"

I have a large file of "ballots" containing the artist's
name and the ranking assigned, 1-500. I want to accumulate
the ranking and count the number of occurrences for each
unique artist to calculate their average ranking and
popularity.

And help appreciated.

Dennis

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to