aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-09-10 09:03:18 +0100
committerGitHub <noreply@github.com>2024-09-10 09:03:18 +0100
commit8da98eb104023e7512fc67d9ce086ec40d5e53cd (patch)
tree4be21cf64c5f57d499eddc87345dae84758aa9f6
parentbc53a5d6740760dc5df8d925b3ee142f9bf5ea6c (diff)
parent5c9e3a8c6c9506a633d6333bbbdbb04c9d6be3b5 (diff)
downloadperlweeklychallenge-club-8da98eb104023e7512fc67d9ce086ec40d5e53cd.tar.gz
perlweeklychallenge-club-8da98eb104023e7512fc67d9ce086ec40d5e53cd.tar.bz2
perlweeklychallenge-club-8da98eb104023e7512fc67d9ce086ec40d5e53cd.zip
Merge pull request #10815 from andrezgz/challenge-282-ch-1-fix
challenge-282-ch-1-fix
-rwxr-xr-xchallenge-282/andrezgz/perl/ch-1.pl4
1 files 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;
}