in reply to Regular expression substitution question
$output =~ s/\x7E(?!$)/\x7D\x5E/g; [download]
-enlil