aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE7-87-83 <fungcheokyin@gmail.com>2021-05-02 22:18:42 +0800
committerE7-87-83 <fungcheokyin@gmail.com>2021-05-02 22:18:42 +0800
commit2d2f56894d29cf5dfa7d4dcdda2ff56131793aae (patch)
tree8d17ce380e1bfddc9707832825e4cd58f30ef6d4
parentced0756512f95aea89d82a1cf575350d0796d509 (diff)
downloadperlweeklychallenge-club-2d2f56894d29cf5dfa7d4dcdda2ff56131793aae.tar.gz
perlweeklychallenge-club-2d2f56894d29cf5dfa7d4dcdda2ff56131793aae.tar.bz2
perlweeklychallenge-club-2d2f56894d29cf5dfa7d4dcdda2ff56131793aae.zip
edit ch-1.pl
-rw-r--r--challenge-110/cheok-yin-fung/perl/ch-1.pl4
1 files changed, 3 insertions, 1 deletions
diff --git a/challenge-110/cheok-yin-fung/perl/ch-1.pl b/challenge-110/cheok-yin-fung/perl/ch-1.pl
index a036df0b9f..e6340acc04 100644
--- a/challenge-110/cheok-yin-fung/perl/ch-1.pl
+++ b/challenge-110/cheok-yin-fung/perl/ch-1.pl
@@ -8,7 +8,9 @@ use warnings;
my $s;
while ($s = <STDIN>) {
chomp($s);
- if (substr($s, -11) =~ / \d{10}/ &&
+ if ( length $s == 15 &&
+ substr($s, 4, 1) eq " " &&
+ substr($s, -11) =~ / \d{10}/ &&
(substr($s,0,4) =~ /\d{4}/ ||
substr($s,0,4) =~ /\+\d{2}/ ||
substr($s,0,4) =~ /\(\d{2}\)/)