my $fh = open_file( 'filename' ); print read_first_line( $fh ); print read_two_lines( $fh ) until eof( $fh ); sub read_first_line { my $fh = shift; return scalar <$fh>; } sub read_two_lines { my $fh = shift; chomp(my $first = <$fh>); return $first . <$fh>; }