#!/usr/bin/perl # # $Id: insensitive-placement 2592 2003-12-21 00:33:01Z jmates $ # # The author disclaims all copyrights and releases this document into # the public domain. # # Template benchmark script with subroutines. use Benchmark qw(cmpthese);; # test the routines here #&tag; # long test strings or reaaally complex regex might make diff? my $test = "aerjymneriDShe3248734 3h4o8 a3wal348 asd j3h43 ASD asdf a435 hjjhg asd sdf foob ar"; cmpthese(-5, { 'default' => \&default, 'pre' => \&pre, 'false' => \&false, 'prefalse' => \&prefalse, }); sub default { $test =~ /asdf/i; } sub pre { $test =~ /(?i)asdf/; } sub false { $test =~ /nomatch/i; } sub prefalse { $test =~ /(?i)nomatch/; }