Dear All,

I have problem in opening the file and closing it in the below mentioned
script. Kindly help me to fix it.

Thanks in advance.

Thanks
Suresh A.




#!/usr/local/bin/perl -w

$shipdir="/databin/OUTGOING/SHIPMENT/bis/suresh";
$custdir="/uhome/cachet/temp/temp1/cust/";
$tloca="/databin/OUTGOING/SHIPMENT/transferlog";

open (FHAN, "<$shipdir/mail-bis") or die "Couldn't open $shipdir for reading: $!\n"; 
open (CHAN, "<$custdir/mail.txt") or die "Couldn't open $custdir for reading: $!\n";

open (THAN, ">> $tloca/bis") or die "Couldn't open $tloca for writing: $!\n";

$infile=<FHAN>;

while ($infile ne "")  { chomp;
        if ( $infile =~ /P\// )   {

                        @localmail=split (" ",$infile);

                        ($val=$localmail[4])=~ s/\.//g;
                        $cfile=<CHAN>;
                                while ($cfile ne "")  {
                                chomp;
                                                if ( $cfile =~ /$val/ )  {

                                                @clmail=split (" ",$cfile);
                                                $count=@clmail;
                                                $clmail[$count-3]=~ s/th|rd|nd//g;     
                                         
                                                                } 
                                                $cfile=<CHAN>;
@lmail=join ("^", @localmail);
@smail=join ("^", $clmail[$count-3],$clmail[$count-2]);
$smail[0]=~ s/^P\///g;                                           

printf THAN ("BIS^@lmail^");
printf THAN ("@smail * \n");
}
close (CHAN);
} 
$infile=<FHAN>;
} 
close (FHAN);
close (THAN);


Thanks
SureshA
[EMAIL PROTECTED]

===============================================================================
      The cause of evil is our desire to be superior to others and our
                               selfishness.
===============================================================================


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

Reply via email to