my ($f1, $f2, $f3, $f4, $f5);
my $c = <>; # get number
($f1,$c) = get_a_factor($c);
print "$f1, ";
($f2,$c) = get_a_factor($c);
print "$f2, ";
($f3,$c) = get_a_factor($c);
print "$f3, ";
($f4,$c) = get_a_factor($c);
print "$f4, ";
($f5,$c) = get_a_factor($c);
print "$f5\n";
sub get_a_factor {
my $num = shift;
... compute factor ...
return ($factor, $num/$factor);
}
####
my $f1;
my $c = <>; # get number
# Get first factor
($f1,$c) = get_a_factor($c);
print $f1;
# Get rest of 'em
while ($c > 1) {
($f1,$c) = get_a_factor($c);
print ", $f1";
}
print "\n";
sub get_a_factor {
my $num = shift;
... compute factor ...
return ($factor, $num/$factor);
}
####
my $f1;
my $c = <>; # get number
# Get factor and the new number to test
while ($c > 1) {
($f1,$c) = get_a_factor($c);
print ", $f1";
}
print "\n";
sub get_a_factor {
my $num = shift;
... compute factor ...
return ($factor, $num/$factor);
}