summaryrefslogtreecommitdiff
path: root/020/ch1.pl
diff options
context:
space:
mode:
authorGuillermo Ramos2019-08-06 14:41:28 +0200
committerGuillermo Ramos2019-08-06 14:41:28 +0200
commit15c6b0541a233e593b1870a188a6e06900f5e074 (patch)
treecc054fc7fead9fe88321ad1c12417f200de48c3f /020/ch1.pl
parent617e9994dae13e899c40383bbe01bd94f6514568 (diff)
downloadperlweekly-15c6b0541a233e593b1870a188a6e06900f5e074.tar.gz
[020#1] Second try
Diffstat (limited to '020/ch1.pl')
-rwxr-xr-x020/ch1.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/020/ch1.pl b/020/ch1.pl
index ede090e..6d8140d 100755
--- a/020/ch1.pl
+++ b/020/ch1.pl
@@ -8,6 +8,8 @@
use strict;
use warnings;
-use 5.13.2;
+my $str = shift;
-print substr(shift =~ s/((.)\g2*)/$1 /gr, 0, -1), "\n";
+my @chunks;
+push @chunks, $1 while ($str =~ /\G((.)\2*)/g);
+print "@chunks\n";