aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-193/southpawgeek/perl/ch-1.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-193/southpawgeek/perl/ch-1.pl b/challenge-193/southpawgeek/perl/ch-1.pl
new file mode 100644
index 0000000000..8baf8a0a11
--- /dev/null
+++ b/challenge-193/southpawgeek/perl/ch-1.pl
@@ -0,0 +1,12 @@
+use feature qw/say/;
+use strict;
+
+my ($bits) = @ARGV;
+
+die "positive integers only\n" unless $bits =~ /^-?\d+\z/ && $bits > 0;
+
+my $count = 0;
+while ($count < 2 ** $bits) {
+ say sprintf('%0'.$bits.'b', $count);
+ $count++;
+} \ No newline at end of file