in reply to Re: When does $_ get used?
in thread When does $_ get used?

I'm sorry I confused the issue. My question wasn't "why doesn't while assign a value to $_" but "why doesn't shift?"

Certainly while( <> ) { ... } works as I expected it to. While talking it over with other helpful monks via the Chatterbox, I found that the individual functions will say if they use $_ in their descriptions.

That being said, is there a good reason why shift (for example) doesn't assign a value to $_ unless another variable is explicitly used?

Replies are listed 'Best First'.
Re: Re: (elbie) When does $_ get used?
by bikeNomad (Priest) on Jul 26, 2001 at 22:05 UTC
    Because, for one thing, it's useful to call shift in void context to remove an array element with no other side-effects. Clobbering $_ in these cases would make it less useful.