http://www.perlmonks.org?node_id=693179

k_grdn has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I'm having trouble re-ordering an array based on predefined values.

my @dports = qw(544 554 80 80 80 80 80 53 22 22 22 22 8080 554 443 80 80 25 110 143 143 110 21 22 111 110);

Desired output:

554 554 554 110 110 110 80 etc...
I have tried numerous solutions but have hit the wall could someone kindly throw some ideas my way.

The script is part of a smaller picture to re-arrange firewall rule precedence based on ports.

Regards,

k_grdn