my @array = grep { /\S/ } split /\n/, ' foo bar baz and so on ';