The hint the warning is giving you is that you're not actually reading from the file and filling the @lines array - see <FILEHANDLE> under I/O Operators and readline. This will also get rid of the warning that the filehandle FILE is only used once. By the way, in modern perl it's better to use lexical filehandles and the three-argument open, as in open my $fh, '<', $filename or die $!;.
Why do you want to use for(;;) instead of foreach or while? The latter is the most common way to read a file line-by-line because it is usually most efficient, and is shown in the above links. (BTW, personally I would write for(;;) instead of foreach(;;).)
Update: For a gentler and shorter introduction, see perlintro, it also has a section "Files and I/O".
In reply to Re: iterative foreach loop
by haukex
in thread iterative foreach loop
by hchana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |