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 30, 2008 22:09
Subject:
Re: bug in if(open(my $fh,...))
Message ID:
20080501050947.7025.qmail@lists.develooper.com
"Dr.Ruud" schreef:
> Renée Bäcker:
>> 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.

Somewhat related:


$ perl -Mstrict -Mwarnings -le'
    my $x = $_ for 1..3;
    print $x;
'
Use of uninitialized value in print at -e line 3.


So $x doesn't keep the value, but isn't reported as a Global symbol
either.

(perl, v5.8.6 built for i386-freebsd-64int)

-- 
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