[t/spec] Add tricky tests (which pass after latest Rakudo patch), unfudge old simple...
[pugs.git] / examples / obfu / random_operator_overloading.pl
blobb5edb4d5f1586aedc1d50a2cc5e8cf676c25a859
1 # This is a *evil* example of random operator overloading.
3 use v6;
5 my $op;
6 BEGIN {
7 # At compilation time, we randomly pick a op to be overloaded.
8 $op = pick <+ - * />;
11 sub infix:{$op} { 42 }
13 # Now one of +-*/ will return 42, the other ops will continue to work as
14 # normal.
15 say "1 + 1 = {1 + 1}";
16 say "1 * 1 = {1 * 1}";
17 say "1 / 1 = {1 / 1}";
18 say "1 - 1 = {1 - 1}";