Useless use of private variable

2011-08-20 Thread Ron Weidner
In the program below the "for loop"  is causing the warning... "Useless use of private variable in void context at ./uselessUse.pl line 16." If I comment out the "for loop" like this the warning goes away... #for($i; $i < $n; $i++) #{     push (@some_array, $i); #} What does the warning mean and

Re: Useless use of private variable

2011-08-20 Thread Alan Haggai Alavi
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 yo

Re: Useless use of private variable

2011-08-20 Thread John W. Krahn
Ron Weidner wrote: In the program below the "for loop" is causing the warning... "Useless use of private variable in void context at ./uselessUse.pl line 16." If I comment out the "for loop" like this the warning goes away... #for($i; $i< $n; $i++) ^^ The first $i is in void context