#!/usr/bin/perl # *Rewrites* files: # # % some string \ # % other string # # ===>> # % some string other string use warnings; use strict; my $file = $ARGV[0]; open(FH, '<', $file) || die "open $file: $!"; my @lines = ; close(FH); open(FH, '>', $file) || die "open $file: $!"; my $concat = 0; foreach (@lines) { if ($concat) { s/^\s*%/ /; } if (s/\\+$//) { chomp; $concat = 1; } else { $concat = 0; } print FH; } close(FH);