use Benchmark; my $junk = 'The quick brown fox Jumped over the lazy dog'; timethese(5000000, { 'split' => '$junk = join \' \',split $junk;', 'regex1' => '$junk =~ tr/\s//;', 'regex2' => '$junk =~ s/\s//g;', }); #### Benchmark: timing 5000000 iterations of regex1, regex2, split... regex1: 3 wallclock secs ( 4.38 usr + 0.00 sys = 4.38 CPU) @ 1142334.93/s (n=5000000) regex2: 3 wallclock secs ( 3.50 usr + 0.00 sys = 3.50 CPU) @ 1426940.64/s (n=5000000) split: 15 wallclock secs (15.07 usr + 0.00 sys = 15.07 CPU) @ 331762.99/s (n=5000000)