#!/usr/local/bin/perl -w use strict; use Benchmark; my $count = 900000; ## Method number two sub One { my $data='for-bar-baz'; $data =~tr/-/_/; } ## Method number Two sub Two { my $data='for-bar-baz'; $data =~s/-/_/g; } ## We'll test each one, with simple labels timethese ( $count, {'Method One TR' => '&One', 'Method Two s'=> '&Two' } ); exit;