#!/usr/bin/perl use Benchmark; timethese(1000, { 'perl' => \&perl_grep, 'system' => \&system_grep, }); sub perl_grep{ open(OUTPUT, "$script | grep EXPRESSION |"); my @output = ; } sub system_grep{ open(OUTPUT, "$script |"); my @output = ; @output = grep { EPRESSION } @output; }