in reply to First code - Factors

I think you're objective is to write your first coed, rather than to compress it to maximal density, so I'll limit my suggestions to:
#!/usr/bin/perl use warnings; my ( $number ) = read_user_number(); my ( $factors ) = factor( $number ); output_number( $factors );

Yes, I've added a complication ... though we generate an array of factors, I return and pass a reference to the array, rather than the list of values.

As Occam said: Entia non sunt multiplicanda praeter necessitatem.