use strict; use warnings; print "Enter a number you want to factor: \n"; my $number = ; my @factor; for (my $count = 2; $count <=sprintf($number/2); $count++) { my $result = int($number / $count); #other approaches were shown.. push (@factor, $result); } print "The factors of $number are: \n"; foreach (@factor) { print "$_\n"; }