+ my $escaped = 0;
+ my $new_str = '';
+
+ for (my $i = 0; $i < length $str; $i++) {
+ my $char = substr $str, $i, 1;
+
+ if ($escaped) {
+ if ($char eq 'n') {
+ $new_str .= "\n";
+
+ } elsif ($char eq 'r') {
+ $new_str .= "\r";
+
+ } elsif ($char eq 's') {
+ $new_str .= ' ';