sub do_something { my $a = shift; # assign 1st arg to $a my $b = shift; # assign 2nd arg to $b my $c = shift; # assign 3rd arg to $c ### now do something with $a, $b, $c return ($a, $b, $c); } my $x = 1; my $y = 2; my $z = 3; my ($x, $y, $z) = do_something($x, $y, $z); Having a subroutine 1. take parameters in, and assign to local variables 2. process the local variables 3. return what needs to be returned