From 5c9e3a8c6c9506a633d6333bbbdbb04c9d6be3b5 Mon Sep 17 00:00:00 2001 From: andrezgz Date: Mon, 9 Sep 2024 22:43:17 -0300 Subject: challenge-282-ch-1-fix --- challenge-282/andrezgz/perl/ch-1.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-282/andrezgz/perl/ch-1.pl b/challenge-282/andrezgz/perl/ch-1.pl index 426e031b30..d4f8999070 100755 --- a/challenge-282/andrezgz/perl/ch-1.pl +++ b/challenge-282/andrezgz/perl/ch-1.pl @@ -38,8 +38,8 @@ sub good_integer { my $d = $-[2] - $-[1]; # if the distance is N, return the sequence return $1 x N if $d == N; - # otherwise, remove these digits and try again - $int = substr $int, $d; + # otherwise, remove up to the last captured digit and try again + $int = substr $int, $-[2]; } return -1; } -- cgit