my %Relevant; foreach my $e (@{$data->{check}}) { #first go though the health checks looking to see if we have relevant checks for this event code if ($e->{relevant_events} =~ $FindEvent ) { $WantedFile = $e->{filename}; $WantedText = $e->{find}; #scan the files for the text we are after DXWanted(); if ($FileStatus == 1) { $Relevant{$e->{severity}} = $e->{note}; $FileStatus = 0; } } #### foreach my $name (sort { $Relevant{$b} <=> $Relevant{$a} } keys %Relevant) { $RESULTS = $RESULTS . "Severity: " . $name . "\n" . $Relevant{$name} . "\n\n" }