develooper Front page | perl.perl5.porters | Postings from June 2015

Re: Question/suggestion on perlfunc.pod example

Thread Previous | Thread Next
Eric Brine
June 7, 2015 06:56
Re: Question/suggestion on perlfunc.pod example
Message ID:
On Mon, May 11, 2015 at 6:21 PM, Aristotle Pagaltzis <>

> … but I’m not sure about $! and there may not be any unambiguous signal
> for that case available.

Yeah, that's wrong. $! can be set even if do succeeds.

That's why you gotta return a true value from files evaluated by do if you
want to perform error checking.

    $ cat
    open(my $fh, "<", "nonexistent");

    $ perl -E'do ""; say $!'
    No such file or directory

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About