aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-01-02 11:19:45 +0000
committerGitHub <noreply@github.com>2024-01-02 11:19:45 +0000
commit624c63b2334ecc4cd35120df7e529a063456c4e9 (patch)
tree9c9c0a120b3a2aff22708b0646386628fa243ebc
parent1e83935def2ee773eab1adfc0be4fd404472e9c5 (diff)
parentf5ef0d8e6f484efbcbbf97c1cd1231941a65c645 (diff)
downloadperlweeklychallenge-club-624c63b2334ecc4cd35120df7e529a063456c4e9.tar.gz
perlweeklychallenge-club-624c63b2334ecc4cd35120df7e529a063456c4e9.tar.bz2
perlweeklychallenge-club-624c63b2334ecc4cd35120df7e529a063456c4e9.zip
Merge pull request #9337 from robbie-hatley/rh250
Fixed error in 250-2.
-rwxr-xr-xchallenge-250/robbie-hatley/perl/ch-2.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-250/robbie-hatley/perl/ch-2.pl b/challenge-250/robbie-hatley/perl/ch-2.pl
index 39c22eb77e..af08afe279 100755
--- a/challenge-250/robbie-hatley/perl/ch-2.pl
+++ b/challenge-250/robbie-hatley/perl/ch-2.pl
@@ -77,17 +77,17 @@ BEGIN {$t0 = time}
# Is a given array ref a ref to a non-empty array containing only alphanumeric strings?
sub is_array_of_alnums ($aref) {
'ARRAY' ne ref($aref) || 0 == scalar(@$aref) and return 0;
- for (@$aref) {!/^[[:alnum:]]+$/ and return 0}
+ for (@$aref) {!/^[a-zA-Z0-9]+$/ and return 0}
return 1;
}
# What is the "alphanumeric string value" of a given scalar?
sub alnum_string_value ($x) {
- $x=~/^[[[:digit:]]+$/ and return 0+$x or return length($x);
+ $x=~/^[0-9]+$/ and return 0+$x or return length($x);
}
# What is the maximum "alphanumeric string value"
-#of the elements of an array of alphanumeric strings?
+# of the elements of an array of alphanumeric strings?
sub max_alnum_string_value ($aref) {
return max map {alnum_string_value $_} @$aref;
}