aboutsummaryrefslogtreecommitdiffstats
path: root/incdec.pm
diff options
context:
space:
mode:
authorTeddy Wing2021-08-08 18:39:00 +0200
committerTeddy Wing2021-08-08 18:40:04 +0200
commit965aafb4d9ff0eba748704b32ab140e9a019dde1 (patch)
treee54fb12d8a801021f4fa02343032ecbf8f579ddd /incdec.pm
parentdb918a0716aaf559c3f64688c2c3ca9388172b7f (diff)
downloadreadline-incdec-965aafb4d9ff0eba748704b32ab140e9a019dde1.tar.bz2
Add a Perl module for performing the action
This allows us to more easily test the functionality and add new behaviours.
Diffstat (limited to 'incdec.pm')
-rw-r--r--incdec.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/incdec.pm b/incdec.pm
new file mode 100644
index 0000000..96b28c8
--- /dev/null
+++ b/incdec.pm
@@ -0,0 +1,14 @@
+use strict;
+use warnings;
+
+package incdec;
+
+sub incdec {
+ my ($line) = @_;
+
+ $line =~ s/(\d+)/$1+1/e;
+
+ return $line;
+}
+
+1;