in reply to Re^3: printing unitialized value of the 'do BLOCK'
in thread printing unitialized value of the 'do BLOCK'

> It's worth noting that if the two forms are equivalent, the latter is probably a lot less confusing when the output value is used.

It's also worth noting that B::Deparse can't always be trusted.

The clause of the if has the same scope like the inner block ( with if (CLAUSE) {BLOCK} )

DB<3> use strict; my $x=3; if (my $x =1) { print $x } 1 DB<4> use strict; if (my $x =1) { print $x }; print $x Global symbol "$x" requires explicit package name (did you forget to d +eclare "my $x"?) at (eval 13)[C:/Perl_524/lib/perl5db.pl:737] line 2. DB<5>

but Deparse fails to cover this with -x7

>>perl -MO=Deparse,-x7 -e"if (my $x =1) { print $x }; print $x" my $x = 1 and do { print $x }; print $x; # <-- no error under strict! -e syntax OK

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice