aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKUEPPO <tcheukueppo@tutanota.com>2022-10-03 13:53:28 +0100
committerGitHub <noreply@github.com>2022-10-03 13:53:28 +0100
commit7ddb964fd18cb74813435ee3bb9442ee5ff3ca19 (patch)
tree795e18365950a573cfa3578c727a9dd1f7c87c6e
parent28dc2b86e008c47b91abdad519be34b4e18338f6 (diff)
downloadperlweeklychallenge-club-7ddb964fd18cb74813435ee3bb9442ee5ff3ca19.tar.gz
perlweeklychallenge-club-7ddb964fd18cb74813435ee3bb9442ee5ff3ca19.tar.bz2
perlweeklychallenge-club-7ddb964fd18cb74813435ee3bb9442ee5ff3ca19.zip
Solution to ch-1 of pwc-185
-rw-r--r--challenge-185/kueppo-wesley/Perl/ch-1.pl14
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-185/kueppo-wesley/Perl/ch-1.pl b/challenge-185/kueppo-wesley/Perl/ch-1.pl
new file mode 100644
index 0000000000..0fabbf7099
--- /dev/null
+++ b/challenge-185/kueppo-wesley/Perl/ch-1.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+my ( @macs, @result ) = qw(1ac2.34f0.b1c2 abc1.20f1.345a);
+
+push @result, tr/.//dr =~ s/(..)(?!$)/$1:/gr foreach @macs;
+
+is_deeply( [ @result ], [ qw(1a:c2:34:f0:b1:c2 ab:c1:20:f1:34:5a) ], "Properly converted mac addresses" );
+
+done_testing( 1 );