TGI has asked for the wisdom of the Perl Monks concerning the following question:

It seems that chr() and pack("C",hex($1)) do the same thing, namely convert a number into a character (from it's ASCII value). Is there an advantage to using one over the other? I've seen the pack approach used in several scripts, but never the chr form? Is something wrong with using chr?

Originally posted as a Categorized Question.

  • Comment on What's the difference between chr() and pack("C",hex($1))?