#!C:/perl/bin -w use strict; # regextiming.pl use vars qw( $string $ms $ms2 ); $string = "fred and barney went bowling last night"; { $ms = Win32::GetTickCount(); if ( $string =~ /fred.+barney/) { } else { print "No match\n\n"; } print "This match used ",Win32::GetTickCount() - $ms, " ticks on a w2k box\n\n"; } # alt --OP expects this to be quicker { $ms2 = Win32::GetTickCount(); if ( $string =~ /fred.+?barney/) { } else { print "No match via second refex\n\n"; exit(); } print "The non-greedy match used ",Win32::GetTickCount() - $ms2, " ticks on a w2k box.\n"; }