I used the below code to sort values and display it as a dropdown in a Perl form page And I need to display a certain value always at the top of the sorted list, how to do that?
values= [sort {$a<=>$b and $orig->{$a} cmp $orig->{$b}} keys %$orig]
I tried this too,not working with me for some reason
values= [sort {if ($a eq 'somevalue') { return 1; }
elsif ($b eq 'somevalue') { return -1; }
else { return {$a<=>$b and $orig->{$a} cmp $orig->{$b}} keys %$orig ;} }]
Any help?