in reply to text sorting question, kinda

I don't know if it's the most efficient, but what about pushing all of the "top of the list" items into one array, the rest into another, then reverse order prepending them onto item2?
while(<INFILE>){ if (match string to move){ @to_move = push $1 }else @regular_order push $1 } } while(@to_move){ unshift @regular_order, $to_move[last] }
Completely untested, no warranty offered or implied! Someone please do it better...

UPDATE Plaid did it better.