aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Smith <js5@sanger.ac.uk>2022-11-28 08:58:58 +0000
committerGitHub <noreply@github.com>2022-11-28 08:58:58 +0000
commit241b8ba8a74f88f411c4d09b96cd81af948d979c (patch)
tree3f0608a76f176bbae36c2b41d9cfe644d1ba61d0
parentd8ed05c6e43da9455384b77f0882b01bba0dd717 (diff)
downloadperlweeklychallenge-club-241b8ba8a74f88f411c4d09b96cd81af948d979c.tar.gz
perlweeklychallenge-club-241b8ba8a74f88f411c4d09b96cd81af948d979c.tar.bz2
perlweeklychallenge-club-241b8ba8a74f88f411c4d09b96cd81af948d979c.zip
Create ch-1.pl
-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
+}