in reply to Re^2: pack auto-chomps/chops?
in thread pack auto-chomps/chops?
your solution works but is slower than just appending a "\n" to the end during the final map
If pack is faster — seems odd — you could use Z instead of A.
Ah, that's tricky. I suppose you're right, though. Do you know if there's a web-browsable version of the Perl source code anywhere I could check into that?
http://perl5.git.perl.org/perl.git Look for pp_unpack in pp*.c (probably pp.c specifically pp_pack.c).
The relevant code:
1458 for (ptr = s+len-1; ptr >= s; ptr--) 1459 if (*ptr != 0 && !isSPACE(*ptr)) break; 1460 ptr++;
and
aka \s#define isSPACE(c) \ ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) =='\r' || (c) + == '\f')
Update: Added relevant code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: pack auto-chomps/chops?
by bv (Friar) on Oct 07, 2009 at 20:04 UTC |