From 15c6b0541a233e593b1870a188a6e06900f5e074 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Tue, 6 Aug 2019 14:41:28 +0200 Subject: [020#1] Second try --- 020/ch1.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to '020/ch1.pl') 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"; -- cgit v1.2.3