develooper Front page | perl.perl5.porters | Postings from April 2008

Re: bug in if(open(my $fh,...))

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
April 29, 2008 20:04
Subject:
Re: bug in if(open(my $fh,...))
Message ID:
20080429133712.6016.qmail@lists.develooper.com
Renée Bäcker schreef:
> Dr.Ruud:

>> The "if (1) {}" can be optimized away, but
>> should at least leave a (scoping) block.
>
> B::Deparse says, that there is a do block:
>
> rbaecker@test ~/ $ perl -MO=Deparse if.pl
> use warnings;
> use strict 'refs';
> do {
>     if (open my $fh, '/etc/passwd') {
>         print 'inner';
>     }
> };
> system "ls -l /proc/$$/fd";

Oops, sorry for the noise.

-- 
Affijn, Ruud

"Gewoon is een tijger."


Thread Previous | Thread Next


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