aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-193/james-smith/perl/ch-1.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-193/james-smith/perl/ch-1.pl b/challenge-193/james-smith/perl/ch-1.pl
new file mode 100644
index 0000000000..28da54e4e6
--- /dev/null
+++ b/challenge-193/james-smith/perl/ch-1.pl
@@ -0,0 +1,13 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+use warnings;
+use feature qw(say);
+
+say join ', ', binary($_) for 1..10;
+
+sub binary {
+ my $t = "%0$_[0]b";
+ map { sprintf $t, $_ } 0.. (1<<$_[0])-1
+}