use file test operator: -e

try this:

my $file = "whatever filename"; #can be absolute or relative path

if (-e $file)
{
     print "$file exists\n";
}
else
{
     print "$file does not exist!\n";
}

Regards,
Sam Dela Cruz








"Samuel M. Chang" <[EMAIL PROTECTED]>

Sent by:
[EMAIL PROTECTED]

05/12/2005 03:35 PM

       
        To:        [email protected]
        cc:        (bcc: Sam Dela Cruz/SVL/SC/PHILIPS)
        Subject:        Test a File If it exists

        Classification:        




Is there a way to test if a specific file exists or not in PERL coding?


Regards,

Sam

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to