in reply to Syntax error with loops

Let me also just add that the following command is completely invalid
inc $printnumber 1;
'inc' is just not perl command...

Perl CAN, of course, increment a number, using $printnumber++ much like in C.

What actually happened is that perl often interprates 'foo bar' as 'bar->foo', a method call. This lets things like the following work naturally
# Java'ish looking way my $Object = new Some::Class( $arg ); # Simple method call my $Object = Some::Class->new( $arg );