Use the List::Util module. I believe List::Util is a core module starting with perl 5.8. For older versions of perl you may need to install the module. See the module documentation for more details: List::Util

use List::Util 'shuffle';
my @deck = (1..52);
my @shuffled_deck = shuffle(@deck);
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.