Hello Ron,

>         for($i; $i < $n; $i++)

When Perl evaluates the initialiser of the for loop, it just sees a `$i`. 
There are no effects for such a statement. Hence the warning. For getting more 
details about warnings, you can use the diagnostics pragma. (See `perldoc 
diagnostics`)

Since you have already initialised $i to 0 (my $i = 0;), you could omit the 
initialiser of the for loop:

    for ( ; $i < $n; $i++ )

Otherwise, as is normal, you can use the for loop's initialiser section to 
declare and then initialise $i to 0:

    for ( my $i = 0; $i < $n; $i++ )

Your program can be rewritten as:

print join ', ', 0 .. 7;

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to