$test =~ s/\n/**/g; ## replace all \n with '**' $test =~ s/\r/!!/g; ## replace all \r with '!!' print STDERR qq/'$test'/;