See, I assumed an XY Problem . I assumed what you really wanted to do was use an already existing encoder/serializer, instead of inventing your own, so I showed you two which use hex encoded characters. One which only does strings (CGI->escape) and one which does complex data structures (JSON)
I guess since this might be homework a practical solution doesn't fit :)
In reply to Re^3: hex in regexp
by Anonymous Monk
in thread hex in regexp
by shamanoff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |