#!/usr/bin/perl -w # backslash: remove trailing backslash characters # based on "Pro Perl" backslash.pl (p195) use strict; while (<>) { chomp; if (s/\\$//) { # trailing backslash? my $line = <>; $_ .= $line, redo; # goes to the 'chomp' above } print "$_\n"; } exit(0);