in reply to while loop over filehandle

you do not need to explicitly count the line where you are. the variable $. holds the current input line:
open (FH, $file) or die "$file: $!"; # need to do it once to initialize $. push @content, scalar (<FH>); while ($. < LINE_COUNT) { push @content, scalar (<FH>); } close (FH);