On 1 Aug 99, at 16:08, Tim Allwine wrote: > You are given N number of cards. > You are to order the cards in such a way that when you > deal the cards according to the RULES all of the cards > on the table are in sequel order. > > The RULES: > Take the top card and place it face up on the table. > Take the next card from the top of the deck and place it > on the bottom of the deck. [...] Seems like the easiest way to do this is just to run the process in reverse: my $cards = $ARGV[0] ; @deck = ($cards); # Ready to deal last card onto the table for (my $i = $cards-1; $i > 0; $i -= 1) { # Move bottom card to the top, then pick up next card from table unshift @deck, $i, pop @deck; } print join(", ", @deck), "\n" ; /Bernie\ -- Bernie Cosell Fantasy Farm Fibers mailto:bernie@fantasyfarm.com Pearisburg, VA --> Too many people, too few sheep <-- ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe