Samn has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: returning entry number in an array
by dws (Chancellor) on Apr 01, 2002 at 06:01 UTC
    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.
    155717
    by Samn (Monk) on Apr 01, 2002 at 06:22 UTC
    Re: returning entry number in an array
    by Chady (Priest) on Apr 01, 2002 at 08:38 UTC
      $FORM{'game'}

      do I smell an MSA here?? ** hint use CGI use CGI use CGI use CGI ...


      He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

      Chady | http://chady.net/