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

Unexpected deparse output

Thread Next
From:
Peter Rabbitson
Date:
October 8, 2014 15:14
Subject:
Unexpected deparse output
Message ID:
5434334F.9050400@rabbit.us
When I run

~$ perl -MO=Deparse -e '
  use constant foo => 0;
  if ( (int(rand(2))+1) % 2 ) {
    warn "foo"
  }
  elsif ( foo ) {
    warn "bar"
  }
'

I get the output

use constant ('foo', 0);
if ((int(rand 2) + 1) % 2) {
     warn 'foo';
}
else {
     '???';
}
-e syntax OK


I would have expected the elsif to disappear entirely. Instead it is 
converted to this weird empty-else. Is the SCOPE op still there or is 
this just Deparse being silly?

Thanks!

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