in reply to Re: Split on comma without whitespace after
in thread Split on comma without whitespace after

Or if you want to split in the case of a trailing comma at the end of the input, you can also use a negative look-ahead:
my @ar = split /,(?!\s), $str;