summaryrefslogtreecommitdiff
path: root/020/ch1.pl
blob: ede090e8bf7c8aef57d068bc783c414f51300cf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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";