From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

<html>
<head>
<title>Define a Subroutine with Args within Embperl</title>
</head>
<body>
[$ sub test ($a, $b) $]
a=[+ $a +]
b=[+ $b +]
[$endsub$]
[$ sub test2 ($a, $b)
$c = $a + $b ;
$]
c=[+ $a +] + [+ $b +] = [+ $c +]
[$endsub$]
[$ sub test3 ($a, $b)
my $c = ($a - $b) ;
$]
a=[+ $a +]
b=[+ $b +]
c=[+ $c +]
[$endsub$]
1,2->[- test(1,2) -]
3,4->[- test(3,4) -]
1,2->[- test2(1,2) -]
3,4->[- test2(3,4) -]
1,2->[- test3(1,2) -]
3,4->[- test3(3,4) -]
<P>Ok.<P>
</body>
</html>