1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl $input_1 = 4; sub fattoriale { local $valore = $_[0]; if ($valore > 1) { return ($valore * &fattoriale ($valore -1)); } else { return 1; } } $miofatt = &fattoriale ($input_1); print "$input_1! = $miofatt\n";
1
4! = 24