#!/usr/bin/perl use strict; use Benchmark; my @text = ('+5000*',            'ein langer Text ohne solche Rechenoperationen...bla fasel laber schwaller sabbel erzähl ...',            '8947573849575563542325375869676545343423232425347585764554534232432452673740-',            '8947573849575563542325375869676545343423232425347585764554534232432452673740+',            '8947573849575563542325375869676545343423232425347585764554534232432452673740*',            '8947573849575563542325375869676545343423232425347585764554534232432452673740/',            '89475738495755635423253758696765453434232324253475857645545342324324526737401',            '-9475738495755635423253758696765453434232324253475857645545342324324526737401',            '+9475738495755635423253758696765453434232324253475857645545342324324526737401',            '*9475738495755635423253758696765453434232324253475857645545342324324526737401',            '/9475738495755635423253758696765453434232324253475857645545342324324526737401',           ); for (@text) {    print "timethesis für '$_'\n";    timethese(100_000, {              A => sub {                         if (m~(?:-|\+|\*|/)~) {}                       },              B => sub {                        if (m~-~ or m~\+~ or m~\*~ or m~/~) {}                       },              C => sub {                         if (m~[-+*/]~) {}                       },              D => sub {                        if (m~[-]~ or m~[+]~ or m~[*]~ or m~[/]~) {}                       },              E => sub {                        if (index($_, '-') > -1 or                            index($_, '+') > -1 or                            index($_, '*') > -1 or                            index($_, '/') > -1) {}                       },             }); }