arranging datas if input file is not having also...!!

hi,

my input file is containg uid, eriMaster ,eriResign, ericontry, dept.
some of the uid are not having all info.

out put should include all info irrespctive of datas of input file
if any one data is missing, then it has to print Null or zero..then continue with the existing one.

here is the code

while(<FILE>) {
my $WORD = $_;
chop $WORD;
if($WORD=~/^uid=/){
printf FILE1 "\n". $WORD." " ;
}else {

    if\($WORD=~/^ou=/\)\{
     printf FILE1 " ".$WORD." ";
     \}
    if\($WORD=~/^eriMaster=/\)\{
        printf FILE1 " ".$WORD." ";
         \}else\{
         printf FILE1 " ".$WORD." " 
        \}       
       elsif\($WORD=~/^eriResign=/\)\{
       printf FILE1 " ".$WORD." ";
            \}

}
}

==========

thanks in advance..