Hi there,
I am trying to unlink a file, but even after supplying the command in my perl script, the file is still there in the directory. Following is my code:
$test_todb1 = $utils_dir."todb1.txt";
chdir ($utils_dir);
if (-e $test_todb1)
{
open(todb1file,$test_todb1);
$line = <todb1file>;
close (todb1file, $test_todb1);
if (substr($line,0,5) eq "TODB1")
{
&get_seq();
&insert_batch();
}
else
{
chdir ($utils_dir);
print ($utils_dir);
unlink ($test_todb1);
}
}
It's the last command 'unlink' where the problem is. I know that the text file doesn't contain the required text and the script is suppose to delete the file in this case. However, when I go to the directory the file is still there.
What am I doing wrong?
Your suggestions and help are most appreciated.
Thanks in advance.
I am trying to unlink a file, but even after supplying the command in my perl script, the file is still there in the directory. Following is my code:
$test_todb1 = $utils_dir."todb1.txt";
chdir ($utils_dir);
if (-e $test_todb1)
{
open(todb1file,$test_todb1);
$line = <todb1file>;
close (todb1file, $test_todb1);
if (substr($line,0,5) eq "TODB1")
{
&get_seq();
&insert_batch();
}
else
{
chdir ($utils_dir);
print ($utils_dir);
unlink ($test_todb1);
}
}
It's the last command 'unlink' where the problem is. I know that the text file doesn't contain the required text and the script is suppose to delete the file in this case. However, when I go to the directory the file is still there.
What am I doing wrong?
Your suggestions and help are most appreciated.
Thanks in advance.