in reply to Count from 1 after a user entered number

Your specification is quite loose, so this may not be what you're after :(

$| = 1; # autoflush print "Enter last number: "; chomp( my $last = <STDIN> ); print join( ", ", 1 .. $last ), "\n"; #Output: #1, 2, 3, 4, 5

Update: Just in case you think I disagree with Joost, you do want

use strict; use warnings;

near the start of your script.

Update^2: I've done no error checking (negative number, not a number, blank line etc), thanks ww. I'll leave that as an exercise. Oh, and chomp isn't needed either.