in reply to Sensing of Null character
If that's the case, you have several options:
{ local $/ = chr 0; chomp $your_string; } # or $your_string =~ s/\x00\z//; [download]
See $/ and perlretut.
I'm sure there are even more possibilites.