my $logfile_recip = '/tmp/recipients.txt'; open my $fh, '<', $logfile_recip or die "Could not open $logfile_recip : $!"; my %count_recip=(); while (my $line = <$fh>) { foreach my $word (split /\s+/, $line) { ++$count_recip{$word}; #print "$word\n"; #print "$count_recip{$word}\n"; #print "
"; #print " \n"; } } #for my $word ( (sort { $count_recip{$b} <=> $count_recip{$a} } keys %count_recip) [0..4] ) { # #print "$word $count_recip{$word}\n"; #} close $fh; my @word_recip = ( (sort { $count_recip{$b} <=> $count_recip{$a} } keys %count_recip) [0..4] ); my @count_word_recip = map{ $count_recip{$_} || 0 } @word_recip; #my $data = GD::Graph::Data->new([ # [@word_recip], # [@count_word_recip], #]) or die GD::Graph::Data->error;