my $string = " \t DATA \t LIST \t \n"; ## my initialization $string = join(" ", split " ", $string); ## From book