Fix my-select performance by rewriting in Perl.