aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE7-87-83 <fungcheokyin@gmail.com>2021-05-18 21:27:42 +0800
committerE7-87-83 <fungcheokyin@gmail.com>2021-05-18 21:27:42 +0800
commit1fdb1a77d9671241ac163b6f12b142f29b249555 (patch)
treef77b042fd6a973728d099d160605f5ec5f13b716
parent65b5fddbc49238a23835d1a3433ebd298ab11b17 (diff)
downloadperlweeklychallenge-club-1fdb1a77d9671241ac163b6f12b142f29b249555.tar.gz
perlweeklychallenge-club-1fdb1a77d9671241ac163b6f12b142f29b249555.tar.bz2
perlweeklychallenge-club-1fdb1a77d9671241ac163b6f12b142f29b249555.zip
small modification on ch-2.pl
-rw-r--r--challenge-113/cheok-yin-fung/perl/ch-2.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-113/cheok-yin-fung/perl/ch-2.pl b/challenge-113/cheok-yin-fung/perl/ch-2.pl
index 5ab92455d7..57ddee363b 100644
--- a/challenge-113/cheok-yin-fung/perl/ch-2.pl
+++ b/challenge-113/cheok-yin-fung/perl/ch-2.pl
@@ -16,7 +16,7 @@ for example, \$ ch-2.pl 2 3 5 x 7
\\
7
FOO
- unless defined($ARGV[0]) && consistency(@ARGV);
+ unless consistency(@ARGV);
my @tree = map { $_ eq 'x' ? undef : $_ } @ARGV;
@@ -36,7 +36,7 @@ print_pretty_tree(@tree);
sub consistency {
my @t = @_;
- return 0 if $t[0] !~ /^\d+$/ && $t[0] ne 'x';
+ return 0 if !defined($t[0]) || ($t[0] !~ /^\d+$/ && $t[0] ne 'x');
for my $ind (1..$#t) {
if ($t[$ind] =~ /^\d+$/) {
if ($t[($ind-1)/2] eq 'x') {