aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-040/roger-bell-west/data19
-rwxr-xr-xchallenge-040/roger-bell-west/perl5/ch-1.pl29
-rwxr-xr-xchallenge-040/roger-bell-west/perl5/ch-2.pl12
-rwxr-xr-xchallenge-040/roger-bell-west/perl6/ch-1.p626
-rwxr-xr-xchallenge-040/roger-bell-west/perl6/ch-2.p69
5 files changed, 76 insertions, 9 deletions
diff --git a/challenge-040/roger-bell-west/data1 b/challenge-040/roger-bell-west/data1
deleted file mode 100644
index a2467461cd..0000000000
--- a/challenge-040/roger-bell-west/data1
+++ /dev/null
@@ -1,9 +0,0 @@
-1) Alex IN: 09:10 OUT: 09:45
-2) Arnold IN: 09:15 OUT: 09:33
-3) Bob IN: 09:22 OUT: 09:55
-4) Charlie IN: 09:25 OUT: 10:05
-5) Steve IN: 09:33 OUT: 10:01
-6) Roger IN: 09:44 OUT: 10:12
-7) David IN: 09:57 OUT: 10:23
-8) Neil IN: 10:01 OUT: 10:19
-9) Chris IN: 10:10 OUT: 11:00
diff --git a/challenge-040/roger-bell-west/perl5/ch-1.pl b/challenge-040/roger-bell-west/perl5/ch-1.pl
new file mode 100755
index 0000000000..5e1640f8eb
--- /dev/null
+++ b/challenge-040/roger-bell-west/perl5/ch-1.pl
@@ -0,0 +1,29 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+my @a=(
+ [qw(I L O V E Y O U)],
+ [qw(2 4 0 3 2 0 1 9)],
+ [qw(! ? £ $ % ^ & *)],
+ );
+
+my $ix=0;
+my $r=1;
+while ($r) {
+ $r=0;
+ my @out;
+ foreach my $iy (0..$#a) {
+ if (exists $a[$iy][$ix]) {
+ push @out,$a[$iy][$ix];
+ $r=1;
+ } else {
+ push @out,' ';
+ }
+ }
+ if ($r) {
+ print join(' ',@out),"\n";
+ }
+ $ix++;
+}
diff --git a/challenge-040/roger-bell-west/perl5/ch-2.pl b/challenge-040/roger-bell-west/perl5/ch-2.pl
new file mode 100755
index 0000000000..bc546fc79f
--- /dev/null
+++ b/challenge-040/roger-bell-west/perl5/ch-2.pl
@@ -0,0 +1,12 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+
+my @list=(10, 4, 1, 8, 12, 3);
+my @indices=(0,2,5);
+
+my @s=sort {$a <=> $b} map {$list[$_]} @indices;
+map {$list[$indices[$_]]=$s[$_]} (0..$#indices);
+
+print join(', ',@list),"\n";
diff --git a/challenge-040/roger-bell-west/perl6/ch-1.p6 b/challenge-040/roger-bell-west/perl6/ch-1.p6
new file mode 100755
index 0000000000..e2352d2174
--- /dev/null
+++ b/challenge-040/roger-bell-west/perl6/ch-1.p6
@@ -0,0 +1,26 @@
+#! /usr/bin/perl6
+
+my @a=(
+ (qw|I L O V E Y O U|),
+ (qw|2 4 0 3 2 0 1 9|),
+ (qw|! ? £ $ % ^ & *|),
+ );
+
+my $ix=0;
+my $r=1;
+while ($r) {
+ $r=0;
+ my @out;
+ for 0..@a.end -> $iy {
+ if (@a[$iy][$ix].defined) {
+ push @out,@a[$iy][$ix];
+ $r=1;
+ } else {
+ push @out,' ';
+ }
+ }
+ if ($r) {
+ say join(' ',@out);
+ }
+ $ix++;
+}
diff --git a/challenge-040/roger-bell-west/perl6/ch-2.p6 b/challenge-040/roger-bell-west/perl6/ch-2.p6
new file mode 100755
index 0000000000..40fa8aa1ea
--- /dev/null
+++ b/challenge-040/roger-bell-west/perl6/ch-2.p6
@@ -0,0 +1,9 @@
+#! /usr/bin/perl6
+
+my @list=(10, 4, 1, 8, 12, 3);
+my @indices=(0,2,5);
+
+my @s=(map {@list[$_]},@indices).sort;
+map {@list[@indices[$_]]=@s[$_]},(0..@indices.end);
+
+print join(', ',@list),"\n";