aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-184/kueppo-wesley/Perl/ch-2.pl18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-184/kueppo-wesley/Perl/ch-2.pl b/challenge-184/kueppo-wesley/Perl/ch-2.pl
new file mode 100644
index 0000000000..b92a07d979
--- /dev/null
+++ b/challenge-184/kueppo-wesley/Perl/ch-2.pl
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+my ( $n, $v ) = -1;
+
+map {
+ $n++;
+ map { push $v->{ m/\d/ ? 'digit' : 'chr' }[ $n ]->@*, $_ } split
+} ( "a 1 2 b 0", "3 c 4 d" );
+
+is_deeply( $v->{digit}, [ [ 1, 2, 0 ], [ 3, 4 ] ], "extracted digits?" );
+is_deeply( $v->{chr}, [ [ 'a', 'b' ], [ 'c', 'd' ] ], "extracted characters?" );
+
+done_testing( 2 );