Thanks for the help but how do I specify the event. This is what I had.
$party='d';
$Statistics = 'a=0,b=2,c=0,d=6,-=0';
foreach my $stats (split(',', $Statistics)) {
print $stats, " \n";
my ($event, $occurance) = split('=', $stats);
$HASH{$event} = $occurance;
}
while ( ($event, $occurance) = each %HASH ) {
sub hashValueNum {
$HASH{$b} <=> $HASH{$a};
}
print "$event equals $occurance.\n";
}
foreach $event (sort hashValueNum (keys(%HASH))) {
print "\t\t$HASH{$event} \t\t $event\n";
}
if (exists ($HASH{$party})) {
print ' yay! ';
}
I want to look in the hash for an event, $party and if $party is their then I want to use the occurance of party to do the calculation. Utilitarian how can I do that in your code?