in reply to Re^4: How can I replace space sequences in a string with the number of spaces in each sequence?
in thread How can I replace space sequences in a string with the number of spaces in each sequence?

you might be interested in the new /r flag to avoid adding $_ explicitly at the end of map.

my $fen= join '/', map { s/( +)/length $1/ger } $input =~ /.{8}/g;

Cheers Rolf

PS: Je suis Charlie!

  • Comment on Re^5: How can I replace space sequences in a string with the number of spaces in each sequence?
  • Select or Download Code