# supposing the program output is all stored in $text: $text =~ s/.*\r//g;