in reply to Newline in left-justified string for %s warning

Why do you think, it helps, removing the newline and adding it again before applying sprintf? Why do you think, you need a newline at that position?

Maybe this is what yo really wanted?

s/[\015\012]//g foreach @rel; # first remove *all* newlines join(" & ", map { sprintf "%-8s (x%s)", $_, 0+@{$rel_hosts{$_}} } @rel +) . "\n"; # add it at the end

$\=~s;s*.*;q^|D9JYJ^^qq^\//\\\///^;ex;print