in reply to Re^3: My Perl-foo... SORT is not strong
in thread My Perl-foo... SORT is not strong

Thank you for your patience. I fixed my spelling errors... *looks sheepish*. Still got the Global symbol "%Relavant" requires explicit package name at PSFT_Automation.pl line 636. Error. (line 636 is the line my $RelavantCount = scalar keys %Relavant; near the end). 2 things look strange to me.. one is I'm declaring the hash at the first line.. Adding to the hash uses $ not %... is that correct? and secondly is this the proper way to get a count of the elements in the hash? my $RelavantCount = scalar keys %Relavant; ?? Again, can't thank you guys enough.

my %Relevant; my %Possible; foreach my $e (@{$data->{check}}) { #first go though the health checks looking to see if we have r +elevant checks for this event code if ($e->{Relavant_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; } } #we also want to run checks for non-relevant items, so we can +add them under the "Automation also found..." text on the internal no +te. else{ $WantedFile = $e->{filename}; $WantedText = $e->{find}; #scan the files for the text we are after DXWanted(); if ($FileStatus == 1) { $Possible{$e->{severity}} = $e->{note}; $FileStatus = 0; } } } #all the checks have been run - now sort the 2 hashes, and print o +ut their contents to the note. my $RelavantCount = scalar keys %Relavant; if ($RelavantCount >= 1) { foreach my $name (sort { $b <=> $a } keys %Relavant) { $RESULTS = $RESULTS . "Severity: " . $name . "\n" . $Relavant{ +$name} . "\n\n" } }

Replies are listed 'Best First'.
Re^5: My Perl-foo... SORT is not strong
by choroba (Cardinal) on Mar 19, 2015 at 16:53 UTC
    "e" and "a" are different characters in all the positions:
    Relevant Relavant Relevent
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      Yes! my problems are all things of the past. My thanks for the original solution to sorting (which does work) and the help in reading my very own spelling errors. Both solutions were, and continue to be, relevant!