Miliser,
Kalau memang TIMTOWTDI :=), bisa nggak kode dibawah ini ditulis lebih 
singkat dan efisien? Mengingat ini dijalankan di mail server, jadi 
dipanggil terus jika ada mail.

Sebenarnya inisialisasi variable perlu nggak sih?

Thanks.

-----<cut here>--------------
$stringInput = 
"T5-3333333\@host.net\0T5-333333333\@goodhost.com\0T33-3333333\@host.net\0\0";

$fax_notallowed = 0;
$fax_wrongformat = 0;
@country_code = qw(1 2 3 4 5 );
$juml_arr_countrycode = $#country_code;
@arr_email = split(/\0+/, $stringInput);
$juml_arr_email = $#arr_email;
for($b=0;$b<=$juml_arr_email;$b++) {
         if ($arr_email[$b] =~ /^T(\d+)\-\d+\@.*/) {
                 $dest = $1;
                 my $fax_allowed = 0;
                 for ($c=0;$c<=$juml_arr_countrycode;$c++){
                     # print " cek : $country_code[$c] vs $dest\n";
                         if ($country_code[$c]==$dest){
                                 # print "ALLOW : $country_code[$c] = $dest\n";
                                 $fax_allowed +=1;
                                 last;
                         }
                 }
                 if (!$fax_allowed) {
                         $fax_notallowed = 1;
                         last;
                 }

                 $allowed_mail[$b] = $fax_allowed;
         } else {
                 $fax_wrongformat = 1;
                 last;
         }
}

($faxmail = $arr_email[$b])=~ s/^T//;

# Aksi jika fax salah format, format yg benar [EMAIL PROTECTED]
if ($fax_wrongformat) {
         ($addr,$host) = split (/\@/,$faxmail);
         print "Format Salah Bung!!\nMail: $faxmail\nDest: $addr Does not 
contain country code\n";
         exit 0;
}
# Aksi jika tujuan fax nggak boleh (tujuan yg diperbolehkan ada di 
@country_code)
if ($fax_notallowed) {
         print "Salah Sasaran Bung!!: \nMail: $faxmail\nDest: $dest Not 
allowed\n";
         exit 0;
}
print "\n\n\nFax DIKIRIM!!!\n";
exit 0;


Cheers,

--P0st


-- 
Utk berhenti langganan, kirim email ke [EMAIL PROTECTED]
Informasi arsip di http://www.linux.or.id/milis.php3

Kirim email ke