Split 

my $line = '  This is  a list of  words  ';

my @parts = split / /, $line;

say Dumper(\@parts);