aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-259/adam-russell/.gitignore3
-rw-r--r--challenge-259/adam-russell/twc.pdfbin67950 -> 0 bytes
-rw-r--r--challenge-272/adam-russell/blog.txt1
-rw-r--r--challenge-272/adam-russell/perl/ch-1.pl25
-rw-r--r--challenge-272/adam-russell/perl/ch-2.pl26
5 files changed, 52 insertions, 3 deletions
diff --git a/challenge-259/adam-russell/.gitignore b/challenge-259/adam-russell/.gitignore
deleted file mode 100644
index d4e9a94d5e..0000000000
--- a/challenge-259/adam-russell/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.bbprojectd
-.RData
-.Rhistory
diff --git a/challenge-259/adam-russell/twc.pdf b/challenge-259/adam-russell/twc.pdf
deleted file mode 100644
index 181cc3d3fa..0000000000
--- a/challenge-259/adam-russell/twc.pdf
+++ /dev/null
Binary files differ
diff --git a/challenge-272/adam-russell/blog.txt b/challenge-272/adam-russell/blog.txt
new file mode 100644
index 0000000000..a791044ed5
--- /dev/null
+++ b/challenge-272/adam-russell/blog.txt
@@ -0,0 +1 @@
+http://www.rabbitfarm.com/cgi-bin/blosxom/perl/2024/06/08
diff --git a/challenge-272/adam-russell/perl/ch-1.pl b/challenge-272/adam-russell/perl/ch-1.pl
new file mode 100644
index 0000000000..3564f846ea
--- /dev/null
+++ b/challenge-272/adam-russell/perl/ch-1.pl
@@ -0,0 +1,25 @@
+
+
+use v5.38;
+
+
+sub defang{
+ my($c, $defanged) = @_;
+ $defanged = [] if !$defanged;
+ return $defanged if @{$c} == 0;
+ my $x = shift @{$c};
+ if($x eq q/./){
+ push @{$defanged}, q/[.]/;
+ }
+ else{
+ push @{$defanged}, $x;
+ }
+ defang($c, $defanged);
+}
+
+
+MAIN:{
+ say join(q//, @{defang([split //, q/1.1.1.1/])});
+ say join(q//, @{defang([split //, q/255.101.1.0/])});
+}
+
diff --git a/challenge-272/adam-russell/perl/ch-2.pl b/challenge-272/adam-russell/perl/ch-2.pl
new file mode 100644
index 0000000000..bbdb2ea352
--- /dev/null
+++ b/challenge-272/adam-russell/perl/ch-2.pl
@@ -0,0 +1,26 @@
+
+
+use v5.38;
+
+
+sub string_score{
+ my($s) = shift;
+ my $score = 0;
+ my @s = map {ord $_} split //, $s;
+ {
+ my $x = shift @s;
+ my $y = shift @s;
+ $score += abs($x - $y) if $x && $y;
+ unshift @s, $y;
+ redo if @s > 1;
+ }
+ return $score;
+}
+
+
+MAIN:{
+ say string_score q/hello/;
+ say string_score q/perl/;
+ say string_score q/raku/;
+}
+