http://qs321.pair.com?node_id=1023727

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear all,

I have a whole bunch (~66k) strings that are long (~400k characters). For all strings the same smallish number of columns need to be removed before the result is printed. So basically:

string1 = 0121012102??????????12121212???????? string2 = 0111011102??????????12111112???????? string3 = 0111011102??????????12111112???????? mask = 0001111111001111001111111 (etc.)

...and now only print out the characters in the strings that correspond with 1 in the mask, omitting the ones that have 0. I've tried doing this by splitting the strings and then taking array slices, but this is way too slow. I suspect there is some clever way if doing this with bitwise operators but I'm still confused how it works after reading the relevant PODs. Anyone have any suggestions?

Thanks!