use strict; use warnings; my ($o, $e, $n) = (1, 0); for $n (0..9) { do { print "Enter number $n : "; $_ = ; s/\D//g; } while $_ eq ''; push @_, $_; } $n = join ' ', @_; for (0..$#_) { if ($_ % 2) { $o *= $_[$_]; } else { $e += $_[$_]; } } print "The list of numbers used is : $n\n" . "The result of adding the even elements is : $e\n" . "The result of multiplying the odd elements is : $o\n";