my $string = "a=b c=d"; my @array = split /(=)|\s/, $string; @array = grep{defined $_}@array;