in reply to Can split split against more than one character in a string of the same character?

split returns the separators when there are captures in the separator regex. So you can simply do
D:\ENV>perl -e "$x = qq#aaaaaaa#; print join '#', split /(..)/, $x" #aa##aa##aa#a
and grep away the empty elements.


holli

You can lead your users to water, but alas, you cannot drown them.
  • Comment on Re: Can split split against more than one character in a string of the same character?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Can split split against more than one character in a string of the same character?
by Don Coyote (Hermit) on Jul 15, 2019 at 22:23 UTC

    Ah, I did think about placing dots in the backward assertion for a brief moment, but even that is ott. I can just split into an array and join that on print. Thanks