Help for this page

Select Code to Download


  1. or download this
    my $file; { local $/; $file = <>; }
    $file =~ s/(?<!\n)\n(?!\n)//g
    print $file;
    
  2. or download this
    perl script.pl infile > outfile
    
    perl -i.bak script.pl file   # in-place
    
  3. or download this
    perl -0777pe's/(?<!\n)\n(?!\n)//g' infile > outfile
    
    perl -i.bak -0777pe's/(?<!\n)\n(?!\n)//g' file