in reply to Re^4: left justify/pad hex value
in thread left justify/pad hex value

Or:
my $data = '10.34.2.252'; printf("%02x%02x%02x%02x\n",split('\.', $data));