Chris Zampese wrote:
> 
> Hello everyone,

Hello,

>    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?


open FILEHANDLE '+< email.txt' or die "Cannot open email.txt: $!";

while ( <FILEHANDLE> ) {
    chomp;
    die "$myvar found\n" if lc $myvar eq lc $_;
    }

print FILEHANDLE "$myvar\n";



John
-- 
use Perl;
program
fulfillment

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

Reply via email to