in reply to output question

Hello enderw2014, welcome to the monastery!

As choroba already said, the angle bracket operator returns everything that was read, including the final newline. Use chomp, or alternatively chop to remove it (the former, essentially being a smarter version of the latter, is usually the better choice). You can even chomp a variable at the same time as assigning to it:

chomp($number = <STDIN>);

A few other tips, since I imagine you're just getting started with Perl:

Have fun with Perl!