use strict; use warnings; my @octets = (10, 34, 2, 252); printf "%02x\n", $_ for @octets;