http://www.perlmonks.org?node_id=1007583


in reply to Re^2: Reading files n lines a time
in thread Reading files n lines a time

Using
while(( my @lines = map $_ = <>, 1 .. 4 )[-1]) {
should stop if the last line is not read as well. (You might need to add defined.)
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ