Oops, thank you for catching that... I haven't gotten that far in my
debugging.

Unfortunately, my problem was with the "if (-e $filename)" always returning
false.  In the code I'm testing, I have the pgp commented out, because I
can't actually unencrypt the files because pgp can only be run by root.

Thank you,

Tim

-----Original Message-----
From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 29, 2008 7:39 PM
To: [EMAIL PROTECTED]
Cc: beginners@perl.org
Subject: RE: Checking to see if file exists.

On Tue, 2008-07-29 at 19:06 -0700, tvadnais wrote:
> Here is the true code if that helps:
> I've tried: 
> 
> foreach my $file ( @currset )
> {
>     my $tmpstr = substr ($file, 0, index($file, ".pgp"));
>     print ("trying to delete $tmpstr \n");
> ## pgp will core dump if there's already an unencrypted file
> ## with the destination source name... So we have to remove the
> ## previously decrypted file if it exists.
>    unlink ($tmpstr);
>     $tmpstr = "/usr/local/bin/pgp -z 'Chars process for WSHA' $file";
>    if (system($tmpstr) == 0) {
>        $notice .= LogMsg (MSG => "system $tmpstr failed: $?", DEBUG =>
> $debug);

system() returns zero for success.  See `perldoc -f system`.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

"Where there's duct tape, there's hope."

"Perl is the duct tape of the Internet."
        Hassan Schroeder, Sun's first webmaster



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to