$hex="abcdef0123"; $hex=~s/([0-9a-fA-F]{2})/$1=/g; @digits=split(/=/,$hex); $octets=join(".",reverse @digits); printf "%s\n%s\n",$hex,$octets; #### perl octet.pl ab=cd=ef=01=23= 23.01.ef.cd.ab