in reply to When every 2 lines of a file (sans first) should be 1...

Aren't you missing a chomp? Assuming so, sSomething like:

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>; }

Replies are listed 'Best First'.
Re^2: When every 2 lines of a file (sans first) should be 1...
by metaperl (Curate) on Dec 04, 2007 at 20:30 UTC
    Aren't you missing a chomp?
    I had this:
    s!\n!!g;
    I have beheld the tarball of 22.1 on ftp.gnu.org with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup
    [tag://sort,etl,data]