in reply to
Just on a side note, would it not be better to use s/\s//g; or tr/\s//;.
I just did a benchmark on the two and the regex is approx 3 times quicker than the $_ = join ' ', split;
This is the benchmarik that I ran.
my $junk = 'The quick brown fox Jumped over the lazy dog';
'split' => '$junk = join \' \',split $junk;',
'regex1' => '$junk =~ tr/\s//;',
'regex2' => '$junk =~ s/\s//g;',
and the results are
Benchmark: timing 5000000 iterations of regex1, regex2, split...
regex1: 3 wallclock secs ( 4.38 usr + 0.00 sys = 4.38 CPU) @ 11
regex2: 3 wallclock secs ( 3.50 usr + 0.00 sys = 3.50 CPU) @ 14
split: 15 wallclock secs (15.07 usr + 0.00 sys = 15.07 CPU) @ 33