use strict; use Benchmark; my %snippet = ( a => 's/\s*#.*//', b => '$_ = $` if /#/', c => 'my ($line) = split/#/', d => '$_ = substr($_, 0, $-[0]) if /#/', e => 'if ((my $p = index($_, "#")) > -1) { substr($_, $p, -1, "") }' ); if (exists $snippet{$ARGV[0]}) { print "Processing $ARGV[0] snippet: '", $snippet{$ARGV[0]}, "'\n"; timethis (-10, $snippet{$ARGV[0]}); } else { print "Missing or invalid parameter to single1.p\n\n"; }