print OUTPUT sprintf('0x%X', $data);
see sprintf
In reply to Re: storing hex data in a file by ccn in thread storing hex data in a file by b4e