This works thanks to a magic aspect of foreach, which is described in perlsyn:foreach my $row ( @rows ) { if ( $row =~ /^$FORM{'game'}/i ) { $row = "new value"; } }
If any element of LIST is an lvalue, you can modify it by modifying VAR inside the loop. That's because the foreach loop index variable is an implicit alias for each item in the list that you're looping over.
In reply to Re: returning entry number in an array
by dws
in thread [untitled node, ID 155711]
by Samn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |