This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
5.004_69: Parsewords.pm: avoid undefined warnings
[perl5.git] / lib / Text / ParseWords.pm
index 95f0e9b..2414f80 100644 (file)
@@ -76,10 +76,12 @@ sub parse_line {
        }
         else {
            $unquoted =~ s/\\(.)/$1/g;
        }
         else {
            $unquoted =~ s/\\(.)/$1/g;
-           $quoted =~ s/\\(.)/$1/g if ($quote eq '"');
-           $quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'");
+           if (defined $quote) {
+               $quoted =~ s/\\(.)/$1/g if ($quote eq '"');
+               $quoted =~ s/\\([\\'])/$1/g if ( $PERL_SINGLE_QUOTE && $quote eq "'");
+            }
        }
        }
-        $word .= ($quote) ? $quoted : $unquoted;
+        $word .= defined $quote ? $quoted : $unquoted;
  
         if (length($delim)) {
             push(@pieces, $word);
  
         if (length($delim)) {
             push(@pieces, $word);