Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 2846c2b6fe3a964eff4f3b3c12eee018 > files > 601

apache-HTML-Embperl-2.2.0-8mdv2010.0.i586.rpm


<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>