in reply to Reordering arrays

To randomly re-order on-the-fly, this should do...

my @lines = <FILE>; print splice( @lines, rand @lines, 1 ) while @lines;

For arbritraty ordering (as in supplied via user input), if you can be assured of having the right number of line orderings and making sure you count from 0 not 1, then you can do an array splice ...

@order = qw( 17 4 23 7 12 19 8 0 16 9 21 1 14 15 6 11 20 3 2 24 5 13 18 10 22 ); print @lines[ @order ]

... assuming you replaced qw() with your CGI input.

    --k.