M
Michele Dondi
If perl6 had another version of tr/// that returned the resulting
string instead of the number of matches, this could be a 1-liner.
It will certainly have the trans() method to that effect.
Michele
If perl6 had another version of tr/// that returned the resulting
string instead of the number of matches, this could be a 1-liner.
Michele said:I have two very long (>64k) strings of equal lengths - $s1 and $s2.
They are strings of bytes, meaning that any value from chr(0) to
chr(255) is legal. $s2, however, will not have any chr(0). $s1 may or
may not have any. What I need to do is look at each byte in $s1 and if
it is chr(0), replace it with the corresponding byte in $s2. So,
something like the following code:
Mirco said:... but will eventually produce the gcc/as/unix variant.
OK, I figured out this part too, so (FWIW) I'll
post it. How's that appliable to the PerlMonks
contest? I don't really know (maybe somebody has a hint).
Michele said:If you don't mind (see the discussion at another part of this thread)
I can report your solution there. Even though the "contest" is now
closed, it would be good (IMHO) for completeness. Or else you can do
so yourself, even as an anonymous poster if you like.
OK, I did (http://perlmonks.org/?node_id=639826) and
btw. found the vec() solutions to be very very fast
on the Core2 platform. Very interesting.
Thanks & regards
Michele said:<http://perlmonks.org/?node_id=638584> would have been more
appropriate. And you may have included the longer portions of code in
readmore tags, just highlighting your contributed code. Anyway, well
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.