aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYsmael Ebreo <Ysmael.Ebreo@latticesemi.com>2020-02-28 00:46:50 +0800
committerYsmael Ebreo <Ysmael.Ebreo@latticesemi.com>2020-02-28 00:46:50 +0800
commitcdb0b83f9e5a7b5d390d3434928a9995bdf3441a (patch)
tree7a5934119bc171d882358142a9b8be5c6667b0b6
parent2826d31467209110ccdd033c271d6ded12350fd7 (diff)
downloadperlweeklychallenge-club-cdb0b83f9e5a7b5d390d3434928a9995bdf3441a.tar.gz
perlweeklychallenge-club-cdb0b83f9e5a7b5d390d3434928a9995bdf3441a.tar.bz2
perlweeklychallenge-club-cdb0b83f9e5a7b5d390d3434928a9995bdf3441a.zip
Added perl5 solution for ch#49-1
-rw-r--r--challenge-049/yet-ebreo/perl5/ch-1.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-049/yet-ebreo/perl5/ch-1.pl b/challenge-049/yet-ebreo/perl5/ch-1.pl
new file mode 100644
index 0000000000..04f63aa2dc
--- /dev/null
+++ b/challenge-049/yet-ebreo/perl5/ch-1.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use feature 'say';
+
+my $num = $ARGV[0] || 55;
+$num < 1 && die "Invalid input (0)";
+
+my $init = 1;
+while (1) {
+ my $bin = sprintf "%b", $init++;
+ ($bin % $num < 1) && (say $bin) && last
+}
+=begin
+perl .\ch-1.pl 72
+111111111000
+
+perl .\ch-1.pl 99
+111111111111111111
+=cut \ No newline at end of file