kapot
12-16-2003, 05:05 PM
I know that
if (-e 'file') { }
can be used to test the existance of a file. But how about the opposite? I need to test if a file is not exist. I tried below, but got failed.
#!/usr/bin/perl
my $dbfile = 'test.db';
if !(-e $dbfile) {
print "does not exists\n";
} else {
print "exists\n";
}
if (-e 'file') { }
can be used to test the existance of a file. But how about the opposite? I need to test if a file is not exist. I tried below, but got failed.
#!/usr/bin/perl
my $dbfile = 'test.db';
if !(-e $dbfile) {
print "does not exists\n";
} else {
print "exists\n";
}
