#!/usr/bin/perl -w use strict; use Benchmark qw(cmpthese); my $file1 = 'first.pl'; my $file2 = 'second.pl'; cmpthese (-5, { 'first' => sub { chdir "/home/firstdir/"; do $file1}, 'second'=> sub { chdir "/home/seconddir/"; do $file2} });