in reply to Reading files n lines a time

We have had similar problem, we used code mentioned below
/usr/bin/perl -w use strict; my @a; while ( (@a) = map { (scalar(<>) or ()) } (0..4) ) { print join("|", @a); }