in reply to Matching positions with lookarounds

warning: Untested
$_ = $finaloutput; my $replace_from = ' '; my $replace_to = '\n'; my $last_position="76"; my $location = rindex(substr($_,0,$last_position),$replace_from); s/(.{0,$location})./$1$replace_to/; print;