Last active
August 29, 2015 14:06
-
-
Save marcoonroad/5064882c61aa94038b8d to your computer and use it in GitHub Desktop.
Try something as 'perl thisScript.pl 1 2 3 4 5 6 7 8 9 10' on command-line...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use warnings; | |
# === Clean way: =============================== # | |
# use List::Util qw/ product /; # | |
# sub factorial { product 1 .. $_[0] } # | |
# print factorial 5; # | |
# ============================================== # | |
sub{print @_,"\n"}->(sub{sub{my($c,$r)=(shift,1);; | |
$r=$c->($r,$_)for@_;$r}->(shift,1..shift)}->(&{sub | |
{sub{$_[0]*$_[1]},shift}}(shift@ARGV)))while@ARGV; | |
# end of script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment