Check for and remove a trailing backslash character
#!/usr/bin/perl use warnings; use strict; my @lines = (); while (<>) { chomp; if (s/\\$//) { my $line = <>; $_.= $line, redo; } push @lines, $_; } foreach (0..$#lines) { print "$_ : $lines[$_] \n"; }