In the first line, $remtag == "1"
should either be a string match
$remtag eq "1"
or a numerical one
$remtag == 1

I don't know if that's your problem, but I'm sure it's
not doing what you want it to . . . .


Good luck!


On Mon, 4 Jun 2001 [EMAIL PROTECTED] wrote:

> } elsif ( $remtag == "1" ) {
>   $remove_email = $formdata{rem_name};
>   open(FILE, "$filename");
>   while (<FILE>) {
>     @fields = split(/\@/, $_);
>     if ( $fields[0] ne $remove_email ) {
>       open(NEWFILE, ">>$tmpfile");
>         print NEWFILE "$_";
>       close(NEWFILE)
>     }
>   }
>   close(FILE);
> }
>
> i am taking a value from a form, say "info".
> i open my file for reading. the file has the format
>
> [EMAIL PROTECTED]    [EMAIL PROTECTED]
> [EMAIL PROTECTED]  [EMAIL PROTECTED]
> [EMAIL PROTECTED]     [EMAIL PROTECTED]
> ...
>
> i read the file in a while loop and split each line based on the @ symbol.
> if the form value "info" does not match the first field of the split array
> item, then i open a temp file and write the entire line to this temp file.
>
> this works a little too well :)
>
> the file loops through a couple times causing multiples of lines from
> $filename to be written to $tmpfile. can someone point out my error?
>
> sorry for so many questions. its my first day with perl.
>
> thanks for everyone's help! -charles
>
>

Reply via email to