Passing values to a function
Let's see a simple example of passing values to a function.
#!/usr/bin/bin perl
use strict;
use warnings;
sub add {
my ($x, $y) = @_;
return $x+$y;
}
print add(2, 3), "\n";
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
Let's see a simple example of passing values to a function.
#!/usr/bin/bin perl
use strict;
use warnings;
sub add {
my ($x, $y) = @_;
return $x+$y;
}
print add(2, 3), "\n";