Skip to content

Instantly share code, notes, and snippets.

@samiron
Created November 9, 2012 04:02
Show Gist options
  • Save samiron/4043627 to your computer and use it in GitHub Desktop.
Save samiron/4043627 to your computer and use it in GitHub Desktop.
Play with Perl Parameters
sub sum{ doit('+', @_) }
sub fact{ mul(1..shift) }
sub mul{ doit('*', @_) }
sub doit
{
my ($d, @nums) = @_;
return eval( join($d, @nums) );
}
print fact(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment