develooper Front page | perl.perl5.porters | Postings from October 2013

[perl #120077] perlfunc -X misleading about return values

Thread Previous
From:
Victor Efimov
Date:
October 2, 2013 12:54
Subject:
[perl #120077] perlfunc -X misleading about return values
Message ID:
rt-3.6.HEAD-31239-1380718430-14.120077-75-0@perl.org
# New Ticket Created by  Victor Efimov 
# Please include the string:  [perl #120077]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=120077 >


> Unless otherwise documented, it returns 1 for true and '' for false, or
the undefined value if the file doesn't exist.

$ ls -la /root/perl5
ls: cannot access /root/perl5: Permission denied

$ perl -e 'defined(-e "/root/perl5") or die $!'
Permission denied at -e line 1

That file exists, however "-e" test returned undef. And I don't see any
other documentation for -e return value on that
http://perldoc.perl.org/functions/-X.html page.

(I suspect it returns undef in case of any system error and sets $!)

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About