Perl split regex with delimiter-prefix



I want to split if in front of the delimiter if there is NOT a special character.

my $str = "a,b,c,d,e";
my @lst = split (/,/, $str);

# gives me: ("a", "b", "c", "d", "e")

# now I want to split after any , with not a character c in front of the ,.
# ("a", "b", "c,d", "e")

I tried

split (/(?!c),/, $str)

but it was not working as expected.

1 Answer: 

Use negative look behind assertion for that which checks backwards.

split (/(?<!c),/, $str)