sysread($rh,$buf,4096) || syslog ( "crit", "$prog : $!" );
You do realize that if sysread returns 0 it is not a critical error and $! will not be set.
if($buf) {
You do realize that the string "0" is also false?
my $client_hostname=unpack('a*', $buf); $client_hostname =~ s/\s+$//g;
If you change the unpack format from 'a*' to 'A*' you won't need the substitution on the next line and it will also remove "\0" characters.
In reply to Re: How to remove trailing white space when =~ s/\s+$//g; doesn't work
by jwkrahn
in thread How to remove trailing white space when =~ s/\s+$//g; doesn't work
by Plankton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |