in reply to When function is executed twice I get the results from the first set in the second

That's because @newdeck is a global variable, and you don't clear it.

I recommend to use strict; use warnings; and declare my @newdeck inside the shuffle sub.

There's also a shuffle function in the core module List::Util, which is tested and works.

Perl 6 - links to (nearly) everything that is Perl 6.
  • Comment on Re: When function is executed twice I get the results from the first set in the second
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: When function is executed twice I get the results from the first set in the second
by gstoykov (Initiate) on Nov 15, 2009 at 18:47 UTC
    Thank you moritz! Declaring the return value as private fixed my issue!