well, i'm strictly speaking from a grammatical point of view, but it would 
seem to me that a

last until eof unless $email;

would be a valid syntax to go through to the end of the file unless $email 
was found.
i'm not sure that this is what i want to do, but i thought i would see what 
would happen if i put it in, other than not working. =)

basically i'm trying to incorporate a way out of the loop i've made.

so after the script has gone through for the first user input and either 
found it or not, then added it if not found, i want to have something 
either End the script, or prompt me to look for another user input.

hope this clarifies what i'm trying to do.

Thanks!


----------------------- code ------------------------
#!/usr/bin/perl -w
#Script to add e-mail or domain name to /etc/mail/access file
#if not already present.

use strict;
#use warnings;

my $email;
my $action;
my $newarray;

open(NAMES,"/etc/mail/access") || die "Can't open access: $!\n";
while (<NAMES>){
         ( $email, $action )= split(/\t/);
         $newarray{$email} = $action;
}
close NAMES;

while(1){
         print "Look for what domain in spam filter? ";
         chomp($email=<STDIN>);
         last until eof unless $email;
                 if( exists $newarray{$email} ){
                 print $newarray{$email}, "\n";
         }else{
                 print "How you wanna handle this one? ";
                 my $action;
                 chomp( $action = <STDIN> );
                 $newarray{$email} = $action;

         }
open(APPEND,">>testfile") || die print "Can't open testfile: $!\n";
#line above to eventually open /etc/mail/access and append $email & $action
#to file.
print APPEND "$email\t$action\n"; #to show that file has been added
close APPEND;
}

eof;

------------------------ eof -------------------------------


At 09:39 PM 7/26/01 +0300, you wrote:
>[EMAIL PROTECTED]

David M.R. Freeman
webmaster sysadmin for MMP, Inc.
web:            www.woodfreeman.com
e-mail: [EMAIL PROTECTED]
phone:  (253) 564-5902
fax:            (253) 565-1811

Reply via email to