in reply to Re: Assigning an array to a scalar
in thread Assigning an array to a scalar
I thought shift should return the array element, so why do I need to use $_ = shift ... ?Because the implied $_ = in a while condition only happens for readline aka <>.
Also, with shift you don't get the implied defined() around the while condition; if one if the elements of @letters is "0", the loop will stop early. Try while (defined($_ = shift @letters))
|
|---|