#!/usr/bin/perl use Benchmark qw(timethese cmpthese); my @seed = ("Hi there 11", "Fred blamed me", "17 o clock", "It's snowing hampsters", "Pickles are people too!"); @text = map {@seed[$_ % $#seed+1]}(0 .. 300); cmpthese -1 => { short_circuit => 'grep(/11/||/are/,@text)', alternate => 'grep(/11|are/,@text)', } __END__ bagelbox:~ josh$ perl testgrep Rate alternate short_circuit alternate 642/s -- -81% short_circuit 3309/s 416% --