use strict; use warnings; use Data::Dumper; my @cards = qw/ A 2 3 4 5 6 7 8 9 10 J Q K /; @cards = shuffle_Deck(@cards); print Dumper(\@cards); sub shuffle_Deck { my @new = (); for (@_) { my $i = int rand($#new+1); push @new, $new[$i]; $new[$i] = $_; }; return(@new); }
In reply to Re: Unexpected value of $_ in a for loop.
by Roger
in thread Unexpected value of $_ in a for loop.
by David Caughell
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |