in reply to When function is executed twice I get the results from the first set in the second
Because you don't clear the global variable @newdeck before calling shuffle() again.
Use the strict and warnings, Luke!