in reply to (All roads lead to Rome) Re: Re: C vs perl
in thread C vs perl

UPDATED
foreach my $alphabeta ( my $z; grep { $z = $_; grep { $z eq $_ } @alphas } @betas ){ # do something }
Granted this still has the same problem as the initial code, but it's twice as fast and saves memory over your speedier (20xOriginal) solution. It also has the side-effect of effectively uniq-ing @betas. If you don't like that replace the outter grep with map.

--
perl -pew "s/\b;([mnst])/'$1/g"