Sometime around 03/03/1999 12:00 AM, Lars G. Skjellerup said something about: >Hi all you gurus > >I have a small problem. I don't seem to be able to use this to >delete a file: > >---------- Code fragment ---------------------- [snip] > ## if I print $pic it contains the right path and filename > > ## I can't find out if it is the open(), unlink or $pic > ## that is the problem. > open(TFH, $pic); > unlink TFH; > close(TFH); >. >From the Camel: -- unlink LIST This function deletes a list of files. If LIST is omitted it unlinks the file given in $_. -- You are trying to unlink the filehandle TFH, not the file contained in the path $pic. try this instead: open(TFH, "<$pic"); # you now have a filehandle to $pic close(TFH); # the filehandle is closed unlink $pic; # the file is gone You could unlink $pic before closing the filehandle, but then Bad Things are likely to happen if you try to read from it then. At any rate, be sure you really do want to delete the file, because in MacPerl there's no second chance. It's gone. Under Unix, unlink removes the directory entries that refer to the real files, and since a file may be referenced from more than one directory, it is not removed until the last reference to it is removed. (paraphrased from the Camel) HTH, D. Beverly -- Credendo vides -- "by believing, one sees..." ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org