You have a precedence problem with the unlink. Since unlink is a list operator and not a unamed unary operator, the statement
( -l && !-e && unlink "$File::Find::name" || croak "Warning: couldn't unlink $File::Find::name:$OS_ERROR\n" +) unless $param{test};
actually binds as
( -l && !-e && unlink ("$File::Find::name" || croak "Warning: couldn't unlink $File::Find::name:$OS_ERROR\n") + ) unless $param{test};
which is certainly not as you intended. I suggest you add explicit parentheses to the unlink. You could also change the "||" to "or" but parentheses are always clearer. Like this:
( -l && !-e && unlink("$File::Find::name") || croak "Warning: couldn't unlink $File::Find::name:$OS_ERROR\n" +) unless $param{test};
In reply to Re: 'unlink' seems to not work correctly ...
by gmargo
in thread 'unlink' seems to not work correctly ...
by chexmix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |