sub myfunction_long { my $z = $_[0] + $_[1]; # add the first 2 parameters and assign result to $z return $z; } sub myfunction_medium { my $z = $_[0] + $_[1]; # add the first 2 parameters and assign result to $z } # value of $z implicitly returned sub myfunction_short { $_[0] + $_[1]; # add the first 2 parameters } # result of expression implicitly returned print myfunction_long(1, 2); # prints 3 print myfunction_medium(1, 2); # prints 3 print myfunction_short(1, 2); # prints 3 #### int z = 0; void myroutine(int x, y) // "void" tells the compiler that no value is returned { z = x + y; // add the values of the 2 defined parameters and assign the result to the global z } int myfunction(int x, y) // "int" tells the compiler that an integer value is returned { return(x + y); // add the values of the 2 defined parameters then return the result }