in reply to Syntax trouble?

the script doesn't do what you describe, first of all your only incrementing once:

else { ($num=$num1++); print $num; print "\n"; }

an then you want to loop, but without test (that should be == not =) and you are confusing until with unless (see perlsyn#Compound Statements)

unless ($num1=$num2) { print $num2; }

IMHO you wanted something like

else { $num=$num1; while ( $num <= $num2 ) { print $num; $num++ } }

Cheers Rolf

UPDATE: corrected $num != $num1 confusion