#!perl use Benchmark; my $junk = 'The quick brown fox Jumped over the lazy dog'; timethese(-10, { 'split' => sub { $x = join '', split ' ', $junk; }, 'trans' => sub { ($x = $junk) =~ tr/ \t\r\n//d; }, 'subst' => sub { ($x = $junk) =~ s/\s+//g; }, }); #### Benchmark: running split, subst, trans, each for at least 10 CPU seconds... split: 43912.46/s subst: 66211.19/s trans: 197755.00/s