SPUG: "Programming Challenge"

David Dyck david.dyck at fluke.com
Wed Dec 17 19:46:05 CST 2003

On Wed, 17 Dec 2003 at 17:12 -0800, Yitzchak Scott-Thoennes <sthoenna at efn.o...:

> Avoid loops at all costs (or keep them in C where they belong):
> use Encode;
> print encode("UCS-2LE", $LSB) ^ encode("UCS-2BE", $MSB);

That's clever, and I'll try to remember it, but
this loop version is a tad faster in my testcases.

for (my $i=0; $i < length $LSB; $i++) {
    print substr($LSB,$i,1).substr($MSB,$i,1)

More information about the spug-list mailing list