Hi,
I'm reading "OReilly Learning Perl 5th Edition", and there are such words:
Code:
You can use an array element like $fred[2] in every place† where you could use any other scalar variable like $fred.
At the bottom of the page, it explains the † like this:
Code:
The most notable exception is that the control variable of a foreach loop, which you’ll see later in this chapter, must be a simple scalar.
Since Perl has the save-and-restore mechanism for the control variable, why an array element can't be used as the control variable?
THANKS!