in reply to fast bit twiddling

Everybody else seems to be handling bits, but you DID specify the input was a string. I think substr is a good solution, but with a wrinkle: grab both characters at the same time, and usee them as index into a hash, like this:
my %res=("00"=>0, "01"=>1,"10"=>1,"11"=>0); my $tmpres=1; foreach (@list) { $tmpres=$tmpres && $res{substr($string,$_-1,2)}; } return tmpres;