Read a file as 4-line chunks
IMHO, the best way is the second example, but with some improvements:

#!/usr/bin/perl
use strict;
use warnings;

open my $fh, '&lt;', 'DUMP' or die $!;
while(&lt;$fh&gt;) {
    print $_;
    print "\n" unless $. % 4;
}


There're no needs to temporary store in an array, and use the $. variable instead of a counter.

$. contains the current line number for the last filehandle accessed, see perlvar

If you want a separte function that returns the chunck:

#!/usr/bin/perl
use strict;
use warnings;

sub getChunck {
    my $file = shift;
    my @chunck;
    open my $fh, '&lt;', $file or die "Unable to open '$file': $!";
    while(&lt;$fh&gt;) {
        push @chunck, $_;
        push @chunck, "\n" unless $. % 4;
    }
    return @chunck;
}

my @chunck = getChunck('DUMP');