From: Perl 5 Porters Date: Wed, 1 May 1996 02:03:41 +0000 (+0000) Subject: Allow for "0" as a word X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb7007dcbd6dbc115b028fb921a92d9dd26e2902;p=p5sagit%2Fp5-mst-13.2.git Allow for "0" as a word --- diff --git a/lib/Text/ParseWords.pm b/lib/Text/ParseWords.pm index 8995138..317597c 100644 --- a/lib/Text/ParseWords.pm +++ b/lib/Text/ParseWords.pm @@ -92,7 +92,7 @@ sub quotewords { local(@words,$snippet,$field,$_); $_ = join('', @lines); - while ($_) { + while (length($_)) { $field = ''; for (;;) { $snippet = ''; @@ -111,11 +111,11 @@ sub quotewords { $snippet = $1; $snippet = "\\$snippet" if ($keep); } - elsif (!$_ || s/^$delim//) { + elsif (!length($_) || s/^$delim//) { last; } else { - while ($_ && !(/^$delim/ || /^['"\\]/)) { + while (length($_) && !(/^$delim/ || /^['"\\]/)) { $snippet .= substr($_, 0, 1); substr($_, 0, 1) = ''; }