in reply to Global in RE not working as expected?

Because  s/,,/,NULL,/g replaces and consumes commas in pairs. E.g.:

c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'abcdef'; ;; $s =~ s{ \w \w }{ print qq{$&}; ',NULL,'; }xmsge; print qq{'$s'}; " ab cd ef ',NULL,,NULL,,NULL,'
Try something like:
c:\@Work\Perl\monks>perl -wMstrict -le "my $s = qq{'XXXX-ax1-d.ett.com','AMRS','AMS','','YYY','ZZ',, , ,}; print qq{'$s'}; ;; $s =~ s{ (?<= ,) \s* (?= , | \z) }{NULL}xmsg; print qq{'$s'}; " ''XXXX-ax1-d.ett.com','AMRS','AMS','','YYY','ZZ',, , ,' ''XXXX-ax1-d.ett.com','AMRS','AMS','','YYY','ZZ',NULL,NULL,NULL,NULL'


Give a man a fish:  <%-{-{-{-<