aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Mochan <mochan@fis.unam.mx>2020-12-09 12:27:59 -0600
committerLuis Mochan <mochan@fis.unam.mx>2020-12-09 12:27:59 -0600
commitd25727270333aa9c090a967d0c46d467393cf908 (patch)
tree37a516269f436a3051f3ec4ccadeb12e4bd83909
parenta2734b4cbec67d4ebd50ce18256820999927e9b1 (diff)
downloadperlweeklychallenge-club-d25727270333aa9c090a967d0c46d467393cf908.tar.gz
perlweeklychallenge-club-d25727270333aa9c090a967d0c46d467393cf908.tar.bz2
perlweeklychallenge-club-d25727270333aa9c090a967d0c46d467393cf908.zip
Test for integer
-rwxr-xr-xchallenge-090/wlmb/perl/ch-2.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-090/wlmb/perl/ch-2.pl b/challenge-090/wlmb/perl/ch-2.pl
index 781624d2d9..44f9f1ab56 100755
--- a/challenge-090/wlmb/perl/ch-2.pl
+++ b/challenge-090/wlmb/perl/ch-2.pl
@@ -9,9 +9,9 @@ use List::Util qw(all);
# receive the two numbers in @ARGV
die 'Usage: ./ch2.pl number1 number2' unless @ARGV==2;
-my ($x, $y)=@ARGV;
-die 'Expected two non-negative integers' # check signs
- unless all {int($_)==$_ && $_>=0} ($x, $y);
+my ($x, $y)= @ARGV; #
+die 'Expected two non-negative integers' # check they are postitive integers
+ unless all {int($_) eq $_ && $_>=0} ($x, $y); #Use eq to avoid implicit int conversion
my $expected_result=$x*$y;
my $result=0;