in reply to array shuffle
Don't modify an array over which you are iterating using foreach. You actually want while (@deck) here anyway. It will produce a really bad shuffle, though. To shuffle a list or array, one normally uses List::Util's shuffle.
Use use strict; use warnings;!!! You forgot to limit the scope many variables.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: array shuffle
by boom.roasted (Initiate) on Aug 18, 2011 at 03:54 UTC | |
by davido (Cardinal) on Aug 18, 2011 at 04:19 UTC | |
by jwkrahn (Abbot) on Aug 18, 2011 at 04:02 UTC | |
by ikegami (Patriarch) on Aug 18, 2011 at 06:03 UTC |