http://www.perlmonks.org?node_id=481576


in reply to Re^3: How can I improve the efficiency of this very intensive code?
in thread How can I improve the efficiency of this very intensive code?

This is exactly what I was going to suggest, apart from a minor optimisation regarding the initialisation of the first value. The I recalled of the existence of reduce in List::Util, which does the job nicely. But maybe I should have been less cryptic and explain what the solution does exactly - thanks for the example, I'll update my post linking to it :)

I know it's a corner case that should not happen, but I'd check for $i2 to be defined before comparing it against $id2.

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.