in reply to Re: Counting characters without a space
in thread Counting characters without a space

Thanks! This should work even though I don't know what the "s+" does.

<code> $original =~ s/,\s+/, /g; </code.

I was considering the above without the s+.

What is happening is they are putting in numbers like this: 1234,4325,5456,6544,4345,5443,3455,4321. Your suggestion should work.

  • Comment on Re^2: Counting characters without a space

Replies are listed 'Best First'.
Re^3: Counting characters without a space
by hippo (Archbishop) on Jul 22, 2018 at 09:45 UTC
    I don't know what the "s+" does.

    It isn't "s+" but rather "\s+" - a small but very important distinction. \s is a character class which includes all whitespace (spaces, tabs, newlines). The + metacharacter matches one or more of the preceding item so this combination matches one or more consecutive whitespaces. See perlre or the Monastery's own tutorials for more on regular expressions.