my $text = "So much spaces,\t\t\t\t\t\ttabs and\n\n\n\n\n\n\n newlines"; $text =~ s!\s+! !g; print $text;