in reply to Newline in left-justified string for %s warning
Meanwhile, if you were originally assigning values to @rel via input from STDIN or another file handle, then it would appear that the strings all have a "\n" at the end (or a literal "\r\n", depending on your OS).
If you "chomp" @rel before passing the values to sprintf, there will be no warnings about newlines -- and the output will appear as specified in the format string, without a newline showing up in front of the " (x".
For that matter, it would be best to do chomp @rel before you use those values as hash keys in %rel_hosts. Having newlines at the ends of hash key values strings is quite unnecessary and generally undesirable.
|
|---|