Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Two sort in single Array set

by kcott (Archbishop)
on Aug 31, 2017 at 05:48 UTC ( [id://1198387]=note: print w/replies, xml ) Need Help??


in reply to Re: Two sort in single Array set
in thread Two sort in single Array set

"(Hope I wrote that right ...)"

Instead of hoping, why not actually check your work. This took me just a few seconds:

$ perl -MO=Deparse -e ' sub sort_comp { my $result = ($a->{severity} <=> $b->{severity}; if ($result == 0) { # severity is the same -- dig deeper if ($a->{severity} eq 'critical'} { $result = ($a->{event_age} <=> $b->{event_age}); #asc } else { $result = ($b->{event_age} <=> $a->{event_age}); #desc } } return $result; } ' syntax error at -e line 3, near "};" syntax error at -e line 5, near "critical}" syntax error at -e line 7, near "} else" Unmatched right curly bracket at -e line 12, at end of line -e had compilation errors.

After you've fixed your code, please ensure you follow the "How do I change/delete my post?" guidelines when correcting your what you wrote.

— Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1198387]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found