in reply to hex in regexp

The standard idiom is:

s/([[:^ascii:]])/ sprintf '%02x', ord $1 /eg;