I am trying to extract the value of the number of males employed by a
company and used the expression below: The file contains data on
several companies. I would then like to store the variable with the
same length. Thus I would like to pad values below "10" by "0". The
problem is that some field have "00" for the number of males employed,
thus I try to test whether all two positions are filled before the
assignment using the expression below, but it seemingly doesn't work,


elsif (/EMPmale=(\S+)/) {
if ($1 == /\S{2}/) {$Emale = $1 ;}
else {$Emale = "0$1" ;}
}

I have also tried,

elsif (/EMPmale=(\S+)/) {
$Emale = $1 if $1 == /\S{2}/ ;
$Emale = "0$1" if $1 == /\S/ ;
}

But it also does not seem to give what I expect. Hope you girls (and
possibly guys) help me as always.


Vumani