From 8e13ac5db1af09673754e3660253782c7ed5b038 Mon Sep 17 00:00:00 2001 From: Peter Scott Date: Mon, 5 Jul 2021 13:04:30 -0700 Subject: Just the one perl solution. Thanks fro keeping the PWC going! --- challenge-120/peter-scott/perl/ch-1.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 challenge-120/peter-scott/perl/ch-1.pl diff --git a/challenge-120/peter-scott/perl/ch-1.pl b/challenge-120/peter-scott/perl/ch-1.pl new file mode 100755 index 0000000000..2890ec4f2a --- /dev/null +++ b/challenge-120/peter-scott/perl/ch-1.pl @@ -0,0 +1,15 @@ +#!/usr/local/bin/perl +use 5.016; +use warnings; + +my $x = shift; +my $y = 0; +for ( 0 .. 3 ) +{ + my $m = 3 << (2*$_); + my $t = $x & $m; + my $s = $t << 1 | $t >> 1; + $y |= $s & $m; +} +say $y; + -- cgit