replacing spaces with null or 0 in the input file

hi
i have records in my input file like this

aaa|1234||2bc||rahul|tamilnadu
bba|2234||b4c||bajaj|tamilnadu

what i am expecting is in between two pipes if there is no character it should be replaced with null or 0

so my file will look like this

aaa|1234|null|2bc|0|rahul|tamilnadu
bba|2234|null|b4c|0|bajaj|tamilnadu

how to do it

can anyone explain

thanks in advance

$ cat tri.txt
aaa|1234||2bc||rahul|tamilnadu
bba|2234||b4c||bajaj|tamilnadu

$ awk 'BEGIN{OFS=FS="|"}{ for(k=0;k<=NF;k++)
if ( $k == "" )
$k="NULL"
print $0}' tri.txt

aaa|1234|NULL|2bc|NULL|rahul|tamilnadu
bba|2234|NULL|b4c|NULL|bajaj|tamilnadu

sed -e 's/||/|null|/g' -e 's/||/|null|/g' FILE

thanks a lot it worked
but i wanted null and 0 to be populated
is there any way for the same

thanks in advance

#! /usr/bin/perl
open FH,"<a.txt";
while(<FH>){
	my @tmp=split("[|]",$_);
	map{$_=$_||"null"} @tmp;
	print join "|",@tmp;
}