KSURi has asked for the wisdom of the Perl Monks concerning the following question:
Hello, monks!
There is a simple script:
There is also another script with a little difference:
The strangeness is that B::Deparse produces the same output for both scripts:
There is a simple script:
It prints 'no match' as expected.use Modern::Perl; my $x = 2.3; given($x) { when(int) { say 'match' } # int($_) ~~ $x default { say 'no match' } }
There is also another script with a little difference:
Prints 'match' as expected.use Modern::Perl; my $x = 2.3; given($x) { when($_) { say 'match' } # $_ ~~ $x default { say 'no match' } }
The strangeness is that B::Deparse produces the same output for both scripts:
Why is this so? Is this a bug of B::Deparse?use Modern::Perl; use warnings; use strict 'refs'; BEGIN { $^H{'feature_say'} = q(1); $^H{'feature_state'} = q(1); $^H{'feature_switch'} = q(1); } my $x = 2.3; given ($x) { when ($_) { say 'match'; } default { say 'no match'; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strange given/when deparsing
by ikegami (Patriarch) on Jun 09, 2009 at 15:53 UTC | |
by akho (Hermit) on Jun 09, 2009 at 16:03 UTC | |
by ikegami (Patriarch) on Jun 09, 2009 at 16:12 UTC | |
by akho (Hermit) on Jun 09, 2009 at 16:41 UTC | |
by ikegami (Patriarch) on Jun 09, 2009 at 16:46 UTC | |
| |
Re: Strange when/given deparsing
by akho (Hermit) on Jun 09, 2009 at 11:06 UTC |
Back to
Seekers of Perl Wisdom