/usr/bin/perl -w use strict; my @a; while ( (@a) = map { (scalar(<>) or ()) } (0..4) ) { print join("|", @a); }