Minor note but you can also do: <<BinaryHead/binary, " ", (to_binary(Tail))/binary >>