The first thing I notice is that he says 0x20 (space) through 0x7E (tilde). but the code has /^\t\040-\176/.
Those are identical ranges, one in hexadeximal, and the other in octal. (He does also allow \t tabs as space, though.)
printf("%d %d %d \n", 040, 32, 0x20); printf("%d %d %d \n", 0176, 126, 0x7E);
A leading zero (040) means the number is read as octal.
A leading zero-ecks (0x20) means the number is read as hexadecimal.
I'm of the opinion that computer-gradeschoolers should learn some very clear "landmark" numbers to help them understand different codebases. (I also plan to teach my daughter to memorize sixteen powers of two in decimal before she leaves the fourth grade. Inchworm, inchworm, measuring the merigolds...)
binary 00001001 = 011 = 9 = 0x9 = nine
binary 00001100 = 014 = 12 = 0xC = a dozen
binary 00111111 = 077 = 63 = 0x3F = six bits full (8x8-1)
binary 01111111 = 0177 = 127 = 0x7F = seven bits full (16x8-1)
binary 11111111 = 0377 = 255 = 0xFF = eight bits full (16x16-1)
binary 1111111111111111 = 0177777 = 65535 = 0xFFFF = sixteen bits full (256x256-1)
--
[ e d @ h a l l e y . c c ]
In reply to Re: Altering Text::CSV to handle Unicode data
by halley
in thread Altering Text::CSV to handle Unicode data
by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |