On Sun, Mar 9, 2008 at 12:23 PM,  <[EMAIL PROTECTED]> wrote:
> Hi,
>  I wish to shuffle 8 decks of cards, so how do I shorten this code :-
>
>  use Algorithm::Numerical::Shuffle qw /shuffle/;
>  @eightdecks = shuffle 
> (1..10,"J","Q","K",1..10,"J","Q","K",1..10,"J","Q","K");#how do I repeat 1 to 
> K 32 times
>  print @eightdecks ;


The x operator can repeat a string or list n times:

my @eightdecks = shuffle ((2..10, qw/J Q K A/) x 32);


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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


Reply via email to