B
Bill H
I dont have the original code with me (its on a pc I have shut down
for the night) but a few days ago I came upon a strange behaviour with
unlink.
The routine basically did the following (I will post real code
tomorrow):
$somevar = &getsomevalue();
sub getsomevalue
{
my $results = "";
my @scratch = ();
open(FILE,"somefile");
@scratch = <FILE>;
close(FILE);
$results = $scratch[0];
# unlink("somefile");
return($results);
}
The above works fine as expected and gets me the value I want in
$somevar. But if I uncomment the unlink, $somevar is always blank! And
yes, the file does exist before I open it (real code checks that).
Can the the value being returned somehow still be linked to that file?
I thought maybe cause I was in the subroutine and put the unlink after
the "$somevar = &getsomevalue()" outside of the subroutine and it
still made $somevar blank???
Bill H
for the night) but a few days ago I came upon a strange behaviour with
unlink.
The routine basically did the following (I will post real code
tomorrow):
$somevar = &getsomevalue();
sub getsomevalue
{
my $results = "";
my @scratch = ();
open(FILE,"somefile");
@scratch = <FILE>;
close(FILE);
$results = $scratch[0];
# unlink("somefile");
return($results);
}
The above works fine as expected and gets me the value I want in
$somevar. But if I uncomment the unlink, $somevar is always blank! And
yes, the file does exist before I open it (real code checks that).
Can the the value being returned somehow still be linked to that file?
I thought maybe cause I was in the subroutine and put the unlink after
the "$somevar = &getsomevalue()" outside of the subroutine and it
still made $somevar blank???
Bill H