in reply to Move matched to top, bottom
The following may appeal:
use strict; use warnings; my @rawentries = ( "1topEndbit", "2ndbit", "endBit3", "4thbit", "5thbit", "6OtherEndbit", "7Bitsecondfromend", "8Bitoneoffend", "9Anyoldbit", ); my @sorted; my @last; /Endbit/i ? push @last, $_ : push @sorted, $_ for @rawentries; push @sorted, @last; print join "\n", @sorted;
Prints:
2ndbit 4thbit 5thbit 7Bitsecondfromend 8Bitoneoffend 9Anyoldbit 1topEndbit endBit3 6OtherEndbit
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Move matched to top, bottom
by quinkan (Monk) on May 03, 2006 at 00:39 UTC |