aboutsummaryrefslogtreecommitdiff
path: root/challenge-131
diff options
context:
space:
mode:
authorE7-87-83 <fungcheokyin@gmail.com>2021-09-26 16:01:45 +0800
committerE7-87-83 <fungcheokyin@gmail.com>2021-09-26 16:01:45 +0800
commita293baa0c6e595d451fc0cd1e7342392038cd7f3 (patch)
treeecae17c17fd9927d16e4dfc5bb1a48c7ba220927 /challenge-131
parenta55eab1183897ff96f579151f73435083de8b3f5 (diff)
downloadperlweeklychallenge-club-a293baa0c6e595d451fc0cd1e7342392038cd7f3.tar.gz
perlweeklychallenge-club-a293baa0c6e595d451fc0cd1e7342392038cd7f3.tar.bz2
perlweeklychallenge-club-a293baa0c6e595d451fc0cd1e7342392038cd7f3.zip
TWC 131
Diffstat (limited to 'challenge-131')
-rw-r--r--challenge-131/blog.txt1
-rw-r--r--challenge-131/cheok-yin-fung/perl/ch-2.pl24
2 files changed, 13 insertions, 12 deletions
diff --git a/challenge-131/blog.txt b/challenge-131/blog.txt
new file mode 100644
index 0000000000..1bc8167a16
--- /dev/null
+++ b/challenge-131/blog.txt
@@ -0,0 +1 @@
+https://e7-87-83.github.io/coding/challenge_131.html
diff --git a/challenge-131/cheok-yin-fung/perl/ch-2.pl b/challenge-131/cheok-yin-fung/perl/ch-2.pl
index e504deaa70..021266f3e8 100644
--- a/challenge-131/cheok-yin-fung/perl/ch-2.pl
+++ b/challenge-131/cheok-yin-fung/perl/ch-2.pl
@@ -147,16 +147,18 @@ sub find_pair {
pop @waiting_to_be_closed;
}
elsif (!defined($neutral_found{$c})) {
- say("Warning: $stack[-1] at position ", $waiting_to_be_closed[-1],
- " does not close appropriately.");
+ say("Warning: $stack[-1] at position ",
+ $waiting_to_be_closed[-1],
+ " may not close appropriately.");
say("Warning: $c at position ", $p,
- " may not be correspond to an opening delimiter.");
+ " may not be corresponding to an opening delimiter.");
$early_warn = 1;
last;
}
else {
- say("Warning: $stack[-1] at position ", $waiting_to_be_closed[-1],
- " does not open or close appropriately." );
+ say("Warning: $stack[-1] at position ",
+ $waiting_to_be_closed[-1],
+ " does not open or close appropriately.");
$early_warn = 1;
last;
}
@@ -177,20 +179,18 @@ sub find_pair {
last;
}
}
- # say "Pos: ", $p;
- # say "STACK: ", @stack;
- # say "WAITING TO BE CLOSED: ", "@waiting_to_be_closed";
}
- if (!$early_warn && scalar @stack != 0 && !defined($close_found{$stack[-1]}) ) {
+ if (!$early_warn && scalar @stack != 0
+ && !defined($close_found{$stack[-1]})
+ ) {
say "Warning: delimiter(s) do not open or close appropriately:";
say "Delimiters: @stack";
say "Positions: ", "@waiting_to_be_closed";
}
if ($early_warn) {
- say "Feedback: It is recommended that you check other delimiters as well.";
+ say "Feedback: It is recommended that you check other ",
+ "delimiters as well.";
}
-
say "";
- return;
}