sub read_entry { my $FH = shift; my @value_arr; while (<$FH>) { return \@value_arr if /EOE/; chomp; # might not be needed, will depend on what will be done next with the array of lines push @value_arr, $_; } }