Thanks for help. For anyone else, the following works.

sub infix:<grew_by_to> {...};

(32 grew_by_to 48).say;

sub infix:<grew_by_to> ($left, $right) {
 return ($right/$left - 1) * 100 ~ '%';
 };


Yuval Kogman wrote:
On Sun, Sep 17, 2006 at 16:35:39 +0100, Daniel Hulme wrote:
What am I doing wrong?
Sounds like you need to define (or at least declare) the new operator
before you use it. Perl 6, like Perl 5 compiles with a single pass, so
when you are using your random operator, it hasn't yet read the
declaration further down the file.

s/use/parse/;

Reply via email to