I'm creating a script that open a directory.
create a file call lock
Work in the directory.
delete the lock file and quit.

my ($rep_em) = "/test";

opendir (DIR, $rep_em) || die ("Error open directory $rep_em.");
chdir($rep_em) || die ("Error change directory to $rep_em");
my @fic = readdir(DIR);
open(LOCK , '>lock') || die ("Unable to create the lock file.");
foreach (@fic) {
        if (!(($_ eq ".") || ($_ eq "..") || ($_ eq "lock"))) {
                printf ("%s \n", $_);
        }
}
close(DIR);
unlink(LOCK) || die ("Unable to delete the lock file.");

I'm able to delete the file manually but when i run the script under the
same user i get an error Unable to delete the lock file at line xx.

Thank for your help.


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


Reply via email to