[Israel.pm] Unlink v/s deletion
gaal at forum2.org
Mon Feb 16 06:03:52 PST 2004
On Mon, Feb 16, 2004 at 02:01:34PM +0000, Srikanth Madani wrote:
> >Change the single quotes to double quotes:
> > my $deleted = unlink ("$fifo_dir/$pipe");
> Perfect; it works!
> I looked at the example from the man pages:
> $cnt = unlink 'a', 'b', 'c';
> and did not realize that the single quotes are only for single characters.
Actually, they do work for more than one character, but they to not perform
variable substitution. Perl was looking for a file literally named $pipe
in a directory literally named $fifo_dir.
Your original error message would do well to include the "$!" variable,
which contains the last error message. In this case it would have given
you the string "file ont found" or maybe "no such directory"; that might
have given you clues for finding the problem.
Gaal Yahas <gaal at forum2.org>
More information about the Perl