Using my inside for statement
$factorial = 1; for (my $loop_index = 1; $loop_index <= 6; $loop_index++) { $factorial *= $loop_index; }