Can you tell me:
$_ = "#x";
my @a = qw/b c/;
foo /#(\w+)/, @a;
bar /#(\w+)/, @a;
quz /#(\w+)/, @a;
baz /#(\w+)/, @a;
Hint implies that it's already solvable.
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
Thanks for the comments, and I did think about it - but I think I want to keep the "trick question" aspect of the node for now ;-)
Also thank you for your other replies, that's certainly getting pretty tricky with the parsing!
Some people want debug functions to disappear without footprint in production.
Like with Smart::Comments but without source filter.
Try to find a way where changing the prototype of a function &dmp will turn the call to a no op.
Your bar /#(\w+)/, @a; is already quite close, but it's still involving a division. :)
Isn't this sufficiently clear?
use constant DEBUG => 0;
warn Dumper($myvar) if DEBUG;
> warn Dumper($myvar) if DEBUG;
clear but unnecessarily verbose.
and the warning will create runtime overhead, too :/
another edge case are empty arrays causing a division by zero...
fixed minor bug
Update: Sorry haukex, the spoilers did not work when I first tried to click on them. Now that I can see them, I understand your point.
Results (426 votes). Check out past polls.