Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: quotation mark as keyby kcott (Archbishop) |
on Aug 08, 2017 at 06:23 UTC ( [id://1196952]=note: print w/replies, xml ) | Need Help?? |
G'day ic23oluk, I see you've been given lots of advice on how to handle that specific character. From your question, it appears that you may be attempting to hard-code each character and ASCII value. That's a lot of effort, and quite unnecessary, for your stated task: "ascii signs as keys, and the corresponding numbers as values". You can do that with a single statement:
That will give you a table of all, printable, 7-bit ASCII characters and their corresponding decimal values. You can test it like this:
Take a look at sprintf, if you want to format the values as hexadecimal, Unicode code points, HTML entity references, or something else. For example,
[Aside: I'm guessing English isn't your first language. The word you were looking for in your OP is "assign" ('n' and 'g' order reversed). The word "assing" means something else: I'll leave you to follow that link if want a chuckle. :-)] — Ken
In Section
Seekers of Perl Wisdom
|
|