$foo =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
In reply to common replacement code ill-understood by Anonymous Monk