Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
print group_reverse( 'How are you?', 2 );
sub group_reverse {
# reverse a string by character grouping
# omit or set second argument to 0 to reverse entire string.
# group_reverse( $string, 1 ) is meaningless.
my( $string, $grouping ) = @_;
# 0 or undef: reverse the entire string
return scalar reverse $string unless $grouping;
my @groups = $string =~ /.{1,$grouping}/g;
@groups = map $_ = reverse, @groups;
return join '', @groups;
}