LINE: while () { chomp; if (s!\\$!!) { $_ .= ; redo LINE; } # At this point, we have gathered all the continuation lines into 1 line. # Now do the rest of the processing. next unless /PATH/; # here you have your PATH line, and can do whatever you need with it. }