in reply to Save first n values from a file

Others have offered varied solutions. Alternatively, you can use splice. Once you have read all the names into an array, you can loop through that array to gather items 3 at a time:
while(@names) { my ($i, $j, $k) = splice (@names, 0, 3); printf('$i is %s, $j is %s, $k is %s', $i, $j, $k); print "\n"; }
Note that if you have strict or warnings enabled, you will get errors like: "Use of uninitialized value $k in printf". You can add error/null checking here to handle all of these. This would also mutate the @names array - keep a defensive copy around. :-)