-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Or maybe let me know if there was a bug in perl 5.6.0?

Here's the situation:

I have a program that scans a specially formatted config file and sends files 
to customers by e-mail.  Within that file is a field that has 
[EMAIL PROTECTED]:filename,[EMAIL PROTECTED]:filename ...
Each file is sent to the address "attached" to it by a colon and the 
combinations are delimited by a comma.  


I have 2 subroutines that run back to back.  The first splits the combinations 
at the commas and puts them ultimately into a hash.  The second checks for 
the existance of the file, and if it does not exist then it removes if from 
the hash.  My problem is that 2 key-value pairs are getting dropped from the 
hash somehow when going from one subroutine to the other.  When I moved the 
offending combo's to the end of the field in the config file, everything 
worked.  There were no syntax problems in the field in the config file, and a 
bunch of print statements in the loops in the first subroutine showed all 
key-value pairs, but in the second there are 2 missing.  I hope I have been 
clear enough to explain the problem.  Let me know if there is something more 
you would like to see...

Here's the code: (the $multi_flag variable is 1)

sub file_split { # This splits the files up depending if they are separated by 
a comma or colon
        if ($multi_flag == 0) {
                @files=split(/\,/,$tmpfile);
        }
        else {
                @mail_and_files=split(/\,/,$tmpfile);
                $count=$#mail_and_files;
                %mail_files=();
                foreach (@mail_and_files) {
                        ($f,$m)=split(/\:/);
                        $mail_files{$m}=$f;
                }
        }
}

sub see_if_exist { # This removes files from either an array or hash that do 
not exist
        if ($multi_flag == 0) {
                foreach (@files) {
                        if (-s $_) {
                                push (@files_exist,$_);
                        }
                }
                $count=scalar(@files_exist);
                if ($count == 0) {
                        print LOGFILE scalar(localtime)," No files processed 
for $cust\n";
                        close LOGFILE;
                        die;}
        }
        else {
                foreach $key (keys(%mail_files)) {
                        if (! (-f $mail_files{$key})) {
                                delete $mail_files{$key};
                        }
                }
        unless (keys(%mail_files)) {
                print LOGFILE scalar(localtime)," No files processed for 
$cust\n";
                close LOGFILE;
                die;}
        }
}


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+1SIGkXvEbfjFKqoRAnpUAKCfxEIDzMbaifQMaqiY5M9nwC7fHwCfTgoF
fm0iq4FUFR2jUEBtMMnGffw=
=P/Oj
-----END PGP SIGNATURE-----


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

Reply via email to