#Sample data, multiline $line = "Line one\nLine two\nthree\nfour"; #process them $line =~ s/(.*)/$1/s; print $line;