use strict; use warnings; use Benchmark 'cmpthese'; cmpthese(-1, { method1 => 'my ($int) = (split "!(?:INT=)?", "SLOT3=4,4,2!INT=115!VC=4!CS=270!PK=/")[1]', method2 => 'my ($int) = ("SLOT3=4,4,2!INT=115!VC=4!CS=270!PK=/")=~ m/\!INT=([^\!]+)/', }); __END__ Rate method1 method2 method1 133487/s -- -64% method2 366033/s 174% --