in reply to how do I use s///e
s/(?<!0x)([1-9]\d*)/sprintf "0x%X", $1/eg
I haven't tested this thoroughly, but this should convert any decimal constant in your source into a C/Perl-style hexadecimal constant. It doesn't handle underscores or floating-point well, but it should skip any already-hexadecimal or already-octal numbers.
--
[ e d @ h a l l e y . c c ]
|
---|