$s = 'hi, there, world, how, are you, today?'; print join "\n", keys %{{ map {$_ => undef} (split /,\s+/, $s)}};