#!/usr/bin/perl # # $Id: greedy-vs-not-char 2592 2003-12-21 00:33:01Z jmates $ # # The author disclaims all copyrights and releases this document into # the public domain. use Benchmark; $source = "ad2349t724j kh24k5j24^ 5khj4i25h8 235 :34678: yu8h2b5j3"; timethese(1000000, { 'non-greedy' => '($foo) = $source =~ /:(.*?):/', 'non-last' => '($foo) = $source =~ /:([^:]+):/', 'digits' => '($foo) = $source =~ /:(\d+):/', });