#!/usr/bin/perl_parallel -w # For Emacs: -*- mode:cperl; mode:folding -*- use strict; use warnings; use Benchmark; my $value = "somewhere here true is there!"; timethese ( 5000000, { 'index' => sub { index( $value, 'true' ) }, 'regex' => sub { $value =~ /true/ }, } ); timethese ( 5000000, { 'index' => sub { index( lc $value, 'true' ) }, 'regex' => sub { $value =~ /true/i }, } );