Anonymous user
Send an unknown method call: Difference between revisions
→{{header|Perl 6}}: demo code like other examples do
m (→{{header|E}}) |
(→{{header|Perl 6}}: demo code like other examples do) |
||
Line 66:
=={{header|Perl 6}}==
Just for the fun of it, we'll mix in an anonymous role into an integer instead of defining a class.
<lang perl6>$object."$methname"(5)</lang>▼
<lang perl6>my $object = 42 but role { method add-me($x) { self + $x } }
my $name = 'add-me';
The double quotes are required, by the way; without them the variable would be interpreted as a hard ref to a method.
=={{header|PHP}}==
|