in reply to Password Program

If, prior to printing out @wrongPasswords, you check the number of elements in the array (print scalar @wrongPasswords) you will find there are 9 - the 5 empty ones that you originally created, plus the 4 wrong guesses that were subsequently pushed onto the array.

Basically, instead of:
@wrongPasswords[4] = ();
you want:
@wrongPasswords = ();

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Password Program
by programmercarlito (Novice) on Mar 01, 2015 at 04:27 UTC

    That is so strange I couldve sworn I did that before. But your right!! Thank you so much syphilis.