From: Tara L Andrews Date: Fri, 30 Sep 2011 22:59:39 +0000 (+0200) Subject: small efficiency tweak X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ecff899fb77228fd1d43fae792c25dc9feca5cdf;p=scpubgit%2Fstemmatology.git small efficiency tweak --- diff --git a/lib/Text/Tradition.pm b/lib/Text/Tradition.pm index 9658167..c508d54 100644 --- a/lib/Text/Tradition.pm +++ b/lib/Text/Tradition.pm @@ -106,12 +106,16 @@ sub witness { my( $self, $sigil ) = @_; my $requested_wit; foreach my $wit ( $self->witnesses ) { - $requested_wit = $wit if $wit->sigil eq $sigil; + if( $wit->sigil eq $sigil ) { + $requested_wit = $wit; + last; + } } # We depend on an undef return value for no such witness. # warn "No such witness $sigil" unless $requested_wit; return $requested_wit; } + # The user will usually be instantiating a Tradition object, and