sub forth_draft { my %xlist = map{ split('\/', $_) } split(',', $match_list); $attrs =~ s/\A$tag //; # clean up for (split (' (?=\w+\=)', $attrs)) { my ($name, $value) = split('='); # little more golfing action (defined $xlist{$name} && $markup =~ s/X\{$name\}/$value/g) ? $xlist{$name} = undef # this exists now : $markup = '' if $markup; # do this and let it run through, faster. last if !$markup; # with out this it drops speed now? } # not in Benchmark # $markup # ? print $markup # : print 'nope'; } #### Benchmark: running a_first_draft, b_second_draft, c_third_draft, d_forth_draft for at least 1 CPU seconds... a_first_draft: 1 wallclock secs ( 1.05 usr + 0.00 sys = 1.05 CPU) @ 29132.76/s (n=30502) b_second_draft: 1 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU) @ 31449.73/s (n=34406) c_third_draft: 1 wallclock secs ( 1.11 usr + 0.00 sys = 1.11 CPU) @ 35255.18/s (n=39098) d_forth_draft: 1 wallclock secs ( 1.06 usr + 0.00 sys = 1.06 CPU) @ 115597.37/s (n=122880)