in reply to Re^3: 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?

This is tested:
my $fen=join('/', map { $_=~s/( +)/length $1/ge; $_; } $self->{rep}=~/.{8}/g );
  • Comment on Re^4: How can I replace space sequences in a string with the number of spaces in each sequence?
  • Download Code

Replies are listed 'Best First'.
Re^5: How can I replace space sequences in a string with the number of spaces in each sequence?
by LanX (Saint) on Feb 04, 2015 at 16:00 UTC
    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!