while (<$sock>) { s/^\0+//; # Remove leading null characters print; # print to screen as well to show raw data and connection chomp($_);