in reply to Re: -z file test operator
in thread -z file test operator

Now I get this error message

Can't exec "BADSYMS.out": Permission denied

This is the code I now have in:

if (-z `BADSYMS.out` ) { # unlink `BADSYMS.out` or die `Cant delete BADSYMS.out`; print "hi"; } else { print "Bad symbols contained in BADSYMS.out\n"; }

I have commented out the unlink, as it was going straight to it, regardless of whether the file was 0 or not. When it prints out the "hi" regardless I know the -z isn't working

any ideas?

Replies are listed 'Best First'.
Re3: -z file test operator
by Hofmator (Curate) on Aug 30, 2001 at 17:41 UTC

    Don't use backticks like `BADSYMS.out` - instead use normal single or double quotes:

    if (-z "BADSYMS.out") { # do something }
    The backticks try to execute the file which is not what you want.

    -- Hofmator