in reply to hex to bin

What about pack ("L",$foo) or pack ("h", $foo)?

-OzzyOsbourne