summaryrefslogtreecommitdiff
path: root/lib/Text/Abbrev.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Text/Abbrev.pm')
-rw-r--r--lib/Text/Abbrev.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Text/Abbrev.pm b/lib/Text/Abbrev.pm
index 893f3b1729..ae6797c81a 100644
--- a/lib/Text/Abbrev.pm
+++ b/lib/Text/Abbrev.pm
@@ -54,10 +54,11 @@ sub abbrev {
my $abbrev = shift(@extra);
my $len = 1;
my $cmp;
- foreach $cmp (@cmp) {
+ WORD: foreach $cmp (@cmp) {
next if $cmp eq $name;
while (substr($cmp,0,$len) eq $abbrev) {
- $abbrev .= shift(@extra);
+ last WORD unless @extra;
+ $abbrev .= shift(@extra);
++$len;
}
}