in reply to Two sort in single Array set

Just use a bit more complex sort routine:
my %severity = ( critical => -1, OK => 1 ); my @sorted = sort { $severity{ $a->{severity} } <=> $severity{ $b->{severity} } || $severity{ $a->{severity} } * ( $a->{event_age} <=> $b->{event_age +} ) } @records;

i.e. when comparing two elements, first compare their severity, and then compare their event age, but reverse the result for the critical ones.

Update: simplified by using negative severity for the critical.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,