>>>>> "Bernie" == Bernie Cosell <bernie@fantasyfarm.com> writes: Bernie> Seems like the easiest way to do this is just to run the process in Bernie> reverse: Or run it forward, then reverse-map it. That's the way I used to do many of my JAPHs. use strict; my @deck = (1..52); # dummy deck, placeholders my @table; { # Take the top card and place it face up on the table. push @table, shift @deck; # Take the next card from the top of the deck and place it # on the bottom of the deck. last unless @deck; push @deck, shift @deck; redo; } ## now for the inverse: my @fixeddeck; # real deck, the answer @fixeddeck[@table] = (1..52); print "@fixeddeck[1..52]\n"; ==> 1 27 2 40 3 28 4 51 5 29 6 41 7 30 8 47 9 31 10 42 11 32 12 50 13 33 14 43 15 34 16 48 17 35 18 44 19 36 20 52 21 37 22 45 23 38 24 49 25 39 26 46 -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe