How come my converted awk/sed/sh script runs more slowly in Perl?
The natural way to program in those languages may not make for the fastest Perl code. Notably, the awk-to-perl translator produces sub-optimal code; see the a2p man page for tweaks you can make. Two of Perl’s strongest points are its associative arrays and its regular expressions. They can dramatically speed up your code when applied properly. Recasting your code to use them can help a lot. How complex are your regexps? Deeply nested sub-expressions with {n,m} or *operators can take a very long time to compute. Don’t use ()’s unless you really need them. Anchor your string to the front if you can. Something like this: next unless /^.*%.