&_q needs to *globally* escape ' and \ in its substitution.
Nicholas Clark [Thu, 27 Jan 2005 11:12:34 +0000 (11:12 +0000)]
p4raw-id: //depot/perl@23883

t/test.pl

index 36a12c3..7550b49 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -101,8 +101,8 @@ sub _q {
     my $x = shift;
     return 'undef' unless defined $x;
     my $q = $x;
-    $q =~ s/\\/\\\\/;
-    $q =~ s/'/\\'/;
+    $q =~ s/\\/\\\\/g;
+    $q =~ s/'/\\'/g;
     return "'$q'";
 }