in reply to [untitled node, ID 155711]

You can actually modify the line (in the array) in place, by doing something like
foreach my $row ( @rows ) { if ( $row =~ /^$FORM{'game'}/i ) { $row = "new value"; } }
This works thanks to a magic aspect of foreach, which is described in perlsyn:
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.

Replies are listed 'Best First'.
155717
by Samn (Monk) on Apr 01, 2002 at 06:22 UTC