Showing posts with label Pass by value example in perl. Show all posts
Showing posts with label Pass by value example in perl. Show all posts

Wednesday, October 19, 2022

Pass by value example in perl

 

sub cube {    
  my $num1 = @_[0];     #num1 parameter passed by value here
  return $num1 * $num1 * $num1; #cube of num1 returned
}





$answer = cube(3); #function cube called with 3 passed as the argument
print $answer ;