From 0193800c1e507cd6fd2e38ff44ab6c2499b9217e Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 25 Jan 2018 23:37:40 -0800 Subject: [PATCH] Remove leading spaces when replacing empty factoid variable --- PBot/Factoids.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 7037aff6..e04e6a09 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -482,7 +482,11 @@ sub expand_factoid_vars { $fixed_a = ucfirst $fixed_a if $a =~ m/^A/; $action =~ s/$a\$$v$modifier/$fixed_a $mylist[$line]/; } else { - $action =~ s/\$$v$modifier/$mylist[$line]/; + if (not length $mylist[$line]) { + $action =~ s/\s+\$$v$modifier//; + } else { + $action =~ s/\$$v$modifier/$mylist[$line]/; + } } } }