On Jul 3, 3:23 am, [EMAIL PROTECTED] (Amichai Teumim) wrote:
> Subject: my deck of cards (once again)

Are you aware that you're reinventing a wheel?
http://search.cpan.org/~akarger/Games-Cards-1.45/lib/Games/Cards.pm

That module already has methods to shuffle a deck, deal cards out to
hands, and pretty much anything else you'd want to do with a deck of
cards.

> The following shuffles up my deck of card

For extraordinarily loose definitions of "shuffles".  There is no
randomness involved in your algorithm at all.  You're far better off
using Games::Cards as referenced above, or at least List::Util's
shuffle() function.

> and then prints out the top
> five cards. I need it to work somehwhat differently.
>
> When I shift or pop an element, I need to
> store it as a variable, then push it on to the array in a different
> order from the original order.

Well... *what* order?  And what is preventing you from doing that?
Save off each pop() or shift(), and then put it onto an array in
whatever order you like.  Could you explain what part of this is
giving you difficulties?

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to