summaryrefslogtreecommitdiff
path: root/020/ch1.pl
diff options
context:
space:
mode:
authorGuillermo Ramos2019-08-05 22:34:11 +0200
committerGuillermo Ramos2019-08-05 22:34:11 +0200
commit617e9994dae13e899c40383bbe01bd94f6514568 (patch)
tree2b5e9990a939efb030f3bb9f264b9a6529186530 /020/ch1.pl
parentd1ca59ce3b49a3f12ae7aadff5217e74350816cb (diff)
downloadperlweekly-617e9994dae13e899c40383bbe01bd94f6514568.tar.gz
[020#1]
Diffstat (limited to '020/ch1.pl')
-rwxr-xr-x020/ch1.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/020/ch1.pl b/020/ch1.pl
new file mode 100755
index 0000000..ede090e
--- /dev/null
+++ b/020/ch1.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/env perl
+#
+# Write a script to accept a string from command line and split it on change of
+# character. For example, if the string is “ABBCDEEF”, then it should split like
+# “A”, “BB”, “C”, “D”, “EE”, “F”.
+################################################################################
+
+use strict;
+use warnings;
+
+use 5.13.2;
+
+print substr(shift =~ s/((.)\g2*)/$1 /gr, 0, -1), "\n";