in reply to How to remove trailing white space when =~ s/\s+$//g; doesn't work
Very mysterious. Try and get a closer look at the string:
print "$_ " foreach(unpack('C*',$client_hostname));
I notice here that ascii 23 (octal 27), the "end of transmission block" character prints as a space, but is not removed by \s.
ps. 'g' is superfluous in that regexp.