print map { chr($_) } map {unpack("H2",$_) } $str =~ m/../g; #### A$ A#??$'@& %&&=!=>B'@ @>>?BA&'B?%$= ==&"$@> "'"A'%@">&