in reply to Re: Need help with loops and 3 tables
in thread Need help with loops and 3 tables

No! Don't use unlink! perldoc -f unlink will tell you why:
unlink LIST
unlink Deletes a list of files. Returns the number of files success-
fully deleted.
$cnt = unlink 'a', 'b', 'c'; unlink @goners; unlink <*.bak>;
Note: "unlink" will not delete directories unless you are supe-
ruser and the -U flag is supplied to Perl. Even if these con-
ditions are met, be warned that unlinking a directory can
inflict damage on your filesystem
. Use "rmdir" instead.

If LIST is omitted, uses $_.

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^3: Need help with loops and 3 tables
by Fletch (Bishop) on Feb 05, 2008 at 23:52 UTC

    So long as you're not running with root permissions the underlying unlink(2) should fail with EPERM (per POSIX) if you try and unlink a directory.

    $ perl -le 'mkdir "OHNOEZ"; unlink "OHNOEZ" or die "unlink: $!\n";rmdi +r "OHNOEZ"' unlink: Operation not permitted

    Your system's rm command's going to be making the same underlying unlink(2) call for the same arguments for that matter; so long as you're not running as root it's a rather spurious thing to worry about.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.