#!/usr/bin/perl -w use strict; use Benchmark qw(cmpthese); #cmpthese gives a nice comparison table use vars qw($s @a $h); # I so that data is visible in evals/subs for sure # $s = shift; # test scalar (ARGV) # @a = ; # test array # %h = map { split/=>/ } # test hash cmpthese ( -10, #ten seconds rather than X number of loops { 'one' => '', # eval string style 'two' => sub {}, # sub ref style }); __DATA__