19 lines
374 B
Perl
19 lines
374 B
Perl
# Perl places all the parameters into an array named @_.
|
|
|
|
# You can access this array directly with the @_ syntax, or access individual parameters.
|
|
|
|
#!/usr/bin/perl -w
|
|
|
|
$value = add(5, 6);
|
|
print "Value from add=$value.\n";
|
|
|
|
$value = add(25, 1);
|
|
print "Value from add=$value.\n";
|
|
|
|
sub add {
|
|
my($a, $b) = @_;
|
|
|
|
my($sum) = $a + $b;
|
|
|
|
return $sum;
|
|
} |