in reply to advancing in file read

Is there a way within the foreach loop to get the next line?

Within the foreach() loop use a "next if ...bla..; statement. That will re-start the loop and get the next line. This works in while() loops also.

To suppress another read, while($no_read && <DATA>){}. This is better than some languages or constructs that use an "un-read" function and is very useful in some parsing situations. Fiddle with the $no_read flag to get the result you require.

I guess while we are on this subject, Perl has a redo function. I use that with extreme caution, but that doesn't mean never use it.