in reply to Regular expression substitution question

Try:
$output =~ s/\x7E(?!$)/\x7D\x5E/g;
update:Yeah, what he said (alas, beaten to the punch again)

-enlil