in reply to How can I tell perl the element is number?
You need to use hex.
map {printf ("%c", hex $_)} split (',', $text);
By the way, I personally prefer not to use map in a void context like that. It produces a list, so use it. I might write the above this way:
print map { sprintf '%c', hex $_ } split q{,}, $text;
If you really want a simple loop, "for" is a good way to go.
printf '%c', hex $_ for split q{,}, $text;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can I tell perl the element is number?
by xiaoyafeng (Deacon) on Aug 13, 2007 at 07:03 UTC |