in reply to while loop on binary : \x30

Update: Adding use bytes at the top of the script does not work. I thought that this would help.

At the top of your script, load bytes.

use bytes;

Though, the Perl doc states the use of this module for anything other than debugging purposes is strongly discouraged.