Replace 4th field if null

Hi ..
Can some one please suggest me how to replace 4th field(column) of a .csv file with "NA" if it is null.
Input file data:

|A|21|B1||1.1|
|A|21|C|RAGH|1.1|
|A|21|D1||1.1|
|A|21|C|YES|1.1

Expected Output

|A|21|B1|NA|1.1|
|A|22|C|RAGH|1.1|
|B|23|D1|NA|1.1|
|A|24|C|YES|1.1|

Thank you...

Next time use CODE-tags when posting code, data or logs to enhance readability and to preserve formatting like indention etc., ty.
Also your post got stuck in the moderation queue since it contains URLs. Just remind of it posting URLs next time - maybe change them a bit so post doesn't get lost.

awk 'BEGIN { FS="|"; OFS="|" } { if ($5=="") $5="NA"; print }' infile > outfile

Also read my note in your post up there please.

awk -F"|" '$5 == "" {$5="NA"; print; next} {print}' OFS="|" infile
|A|21|B1|NA|1.1|
|A|21|B1|www.none.com|1.1|
|A|21|B1|NA|1.1|
|A|21|B1|www.trail.com|1.1|

Thanks a lot fpmurphy !!! it worked.

perl -ne '{s/(?<=\|)(?=\|)/NA/g;print;}'