Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a program to simulate the shuffling of a deck of cards. So far it works fine, with one problem -- repeat cards keep turning up. Is there any way to cut an arbitrary value out of an array? The code works like this:
while ($game_hand < 12) {I'd like a function that could cut whatever value $_ gets out of @deck completely, during the loop so I don't have to go through and check it for redundancy at a later point (and yes, I know about splice: for whatever reason, in this case it doesn't work and ends up giving me more repeat values... ugh).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: removing arbitrary elements from an array?
by chromatic (Archbishop) on Mar 15, 2000 at 21:22 UTC | |
|
Re: removing arbitrary elements from an array?
by gronkulator (Sexton) on Mar 15, 2000 at 21:31 UTC | |
|
Re: removing arbitrary elements from an array?
by btrott (Parson) on Mar 17, 2000 at 03:25 UTC | |
|
RE: removing arbitrary elements from an array?
by Anonymous Monk on Mar 15, 2000 at 21:18 UTC | |
|
RE: removing arbitrary elements from an array?
by Anonymous Monk on Mar 15, 2000 at 21:12 UTC |