aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-113/abigail/lua/ch-2.lua6
-rw-r--r--challenge-113/abigail/perl/ch-1.pl2
-rw-r--r--challenge-113/abigail/perl/ch-2.pl4
3 files changed, 5 insertions, 7 deletions
diff --git a/challenge-113/abigail/lua/ch-2.lua b/challenge-113/abigail/lua/ch-2.lua
index 15aac1ac2d..5ba4c04ed9 100644
--- a/challenge-113/abigail/lua/ch-2.lua
+++ b/challenge-113/abigail/lua/ch-2.lua
@@ -10,16 +10,16 @@
for line in io . lines () do
local sum = 0
- for n in line : gmatch ("[0-9]+")
+ for n in line : gmatch ("-?[0-9]+")
do sum = sum + tonumber (n)
end
local c = 0
- for n in line : gmatch ("[0-9]+")
+ for n in line : gmatch ("-?[0-9]+")
do if c > 0
then io . write (" ")
end
c = c + 1
- io . write (sum - n)
+ io . write (sum - tonumber (n))
end
io . write ("\n")
end
diff --git a/challenge-113/abigail/perl/ch-1.pl b/challenge-113/abigail/perl/ch-1.pl
index 51a4842116..bb45261f33 100644
--- a/challenge-113/abigail/perl/ch-1.pl
+++ b/challenge-113/abigail/perl/ch-1.pl
@@ -70,8 +70,6 @@ use experimental 'lexical_subs';
#
# These are all the ls < $D so that $D does not divide 10 * l.
-my @l = ([], [], [1], [1 .. 2], [1],
- [], [1 .. 2], [1 .. 6], [1 .. 3], [1 .. 8]);
my @tens = (0, 0, 1, 2, 1, 0, 2, 6, 3, 8);
MAIN: while (<>) {
diff --git a/challenge-113/abigail/perl/ch-2.pl b/challenge-113/abigail/perl/ch-2.pl
index 4d7eeece79..7aabcc4b13 100644
--- a/challenge-113/abigail/perl/ch-2.pl
+++ b/challenge-113/abigail/perl/ch-2.pl
@@ -14,7 +14,7 @@ use experimental 'lexical_subs';
#
#
-# Run as: perl ch-1.pl < input-file
+# Run as: perl ch-2.pl < input-file
#
#
@@ -34,6 +34,6 @@ use experimental 'lexical_subs';
use List::Util qw [sum];
while (<>) {
- my $sum = sum my @num = /[0-9]+/g;
+ my $sum = sum my @num = /-?[0-9]+/g;
say join " " => map {$sum - $_} @num;
}