1

Perl : joining alternate lines

view story
linux-howto

http://www.unix.com – Hi, I need to join every alternate line in a file for eg:input file Code: $ cat abc abc def ghi jkl output Code: abc def ghi jkl code i wrote for this Code: $ cat add_line.pl #!/usr/bin/perl -w my $count=1; #my $line=undef; my @mem_line; my $i=0; my $x=0; while(<>) { chomp; $x=$count % 2; #print "$x $_\n";         if ( $x == 1 )         {                 $mem_line[$i] = "$_";         }         else         { & (HowTos)