X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fabbrev.pl;h=62975e66f326eed23d16fa5ff25e3e3283611443;hb=cb63fe9d2e5798dd9efb493d9c26775aea114f76;hp=5859a7be48d8f0376fe231b94b8557c86d6d742c;hpb=a687059cbaf2c6fdccb5e0fae2aee80ec15625a8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/abbrev.pl b/lib/abbrev.pl index 5859a7b..62975e6 100644 --- a/lib/abbrev.pl +++ b/lib/abbrev.pl @@ -10,13 +10,14 @@ sub main'abbrev { local(*domain) = @_; shift(@_); @cmp = @_; + local($[) = 0; foreach $name (@_) { @extra = split(//,$name); $abbrev = shift(@extra); $len = 1; foreach $cmp (@cmp) { next if $cmp eq $name; - while (substr($cmp,0,$len) eq $abbrev) { + while (@extra && substr($cmp,0,$len) eq $abbrev) { $abbrev .= shift(@extra); ++$len; }