in reply to Global in RE not working as expected?

You need to use a lookahead instead. Without that each s/,,/whatever/ eats up 2 commas so the 2nd and 3rd comma in a row in the original text are never tested. Here's a solution:

my $sql = "'XXXX-ax1-d.ett.amrs.bankofamerica.com','UAT','AMRS','AMS', +'','YYYY','ZZZZ',,,,"; print "$sql\n"; $sql =~ s/,(?=,)/,NULL/g; print "$sql\n";