Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sub modify_flat_file{ open (USERFILE, "$flat_file"); $ID_matched = 0; while (<USERFILE>) { chop($_); @f = ($a, $ID, $b, $c)=split(/\|/,$_); if ($f[1] eq $FORM{'ID'}) { $ID_matched = 1; last;} close (USERFILE); if ($ID_matched == 1){ print USERFILE "$FORM{'new_a'}|$ID|$FORM{'new_b'}$FORM{'new_c'}'\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: modifying a matched line in a flatfile
by lshatzer (Friar) on Jun 04, 2002 at 17:56 UTC | |
Re: modifying a matched line in a flatfile
by silent11 (Vicar) on Jun 04, 2002 at 17:55 UTC | |
Re: modifying a matched line in a flatfile
by Abigail-II (Bishop) on Jun 05, 2002 at 09:52 UTC |