aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-07-06 00:10:08 +0100
committerGitHub <noreply@github.com>2021-07-06 00:10:08 +0100
commit9efe790259998548daf51c28c4c14fb99077e97d (patch)
treea17d241121faf3d79f981f5ceab2088e6a097d50
parent8e6b9a5d3a247ef650c8eadb7d666dfe23e541d7 (diff)
parent8e13ac5db1af09673754e3660253782c7ed5b038 (diff)
downloadperlweeklychallenge-club-9efe790259998548daf51c28c4c14fb99077e97d.tar.gz
perlweeklychallenge-club-9efe790259998548daf51c28c4c14fb99077e97d.tar.bz2
perlweeklychallenge-club-9efe790259998548daf51c28c4c14fb99077e97d.zip
Merge pull request #4440 from pjscott/branch-for-challenge-120
Just the one perl solution. Thanks fro keeping the PWC going!
-rwxr-xr-xchallenge-120/peter-scott/perl/ch-1.pl15
1 files changed, 15 insertions, 0 deletions
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;
+