From 8ac79a4cb2b7cf3780305ba3ce8c1040a1f33093 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 2 Dec 2017 15:05:30 -0800 Subject: [PATCH] Move lc out of loop (does Perl already optimize for this?) --- PBot/Commands.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PBot/Commands.pm b/PBot/Commands.pm index 31823d38..96d63638 100644 --- a/PBot/Commands.pm +++ b/PBot/Commands.pm @@ -80,8 +80,9 @@ sub exists { my $self = shift; my ($keyword) = @_; + $keyword = lc $keyword; foreach my $ref (@{ $self->{handlers} }) { - return 1 if $ref->{name} eq lc $keyword; + return 1 if $ref->{name} eq $keyword; } return 0; }