while ( <FILEHANDLE> ) {
        push(@new_names, $_) unless ($_ eq $myvar);
}

# now you have a list of new names you can append to the file

open(FILEHANDLE, ">>somefile.txt");

        print FILEHANDLE join("\n", @new_names);

close FILEHANDLE;

deen

On Wed, 30 Jan 2002, Chris Zampese wrote:

> Hello everyone,
>    I have a variable $myvar (an email address), and I would like to open
> a simple text file which contains email addresses (one on each line) and
> check to see if the address in $myvar is in there, if it is not, then
> append it o the end of the file, and if it is, then close the file and
> carry on with the rest of the script.
>   I have tried using while (<FILEHANDLE>){},
>  but I am not really sure what to put in the brackets?
> 
> Thanks as always,
>                      Chris.
> 

-- 
Deen Hameedd, Accidental Programmer [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to