$ perl -E 'my @x = split /(..)/, "1234"; say "|$_|" for @x' || |12| || |34| $ perl -E 'my $x = join "_", split /(..)/, "1234"; say $x' _12__34