diff options
| author | k-mx <cppfero@gmail.com> | 2019-10-21 20:27:23 +0500 |
|---|---|---|
| committer | k-mx <cppfero@gmail.com> | 2019-10-21 20:27:23 +0500 |
| commit | 368712a38adde5d366c0d8c7496a96aeee80ed24 (patch) | |
| tree | 6226e4179ecba0827f8aa0a67af4c98198b6c2f8 | |
| parent | c8ed06a6ac9b21391ab165f4a7f897cd92e4df34 (diff) | |
| download | perlweeklychallenge-club-368712a38adde5d366c0d8c7496a96aeee80ed24.tar.gz perlweeklychallenge-club-368712a38adde5d366c0d8c7496a96aeee80ed24.tar.bz2 perlweeklychallenge-club-368712a38adde5d366c0d8c7496a96aeee80ed24.zip | |
improved challenge-031.1 by Maxim Kolodyazhny
| -rw-r--r-- | challenge-031/maxim-kolodyazhny/perl5/ch-1.pl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/challenge-031/maxim-kolodyazhny/perl5/ch-1.pl b/challenge-031/maxim-kolodyazhny/perl5/ch-1.pl index 015c03f4b5..68e4bea178 100644 --- a/challenge-031/maxim-kolodyazhny/perl5/ch-1.pl +++ b/challenge-031/maxim-kolodyazhny/perl5/ch-1.pl @@ -3,8 +3,12 @@ use strict; use warnings; -sub div { +use constant ANSWER2EVERYTHING => 42; + +sub harmless_division { my ($x, $y ) = @_; - 42^$y^42 ? $x / $y : undef; + return if $y == int $y && ( ANSWER2EVERYTHING ^ $y ) == ANSWER2EVERYTHING; + + $x / $y; } |
