First, please format your code using CODE tags. Right now, it's virtually unreadable, as opposed to this:
...
$pessoais = "produtos/pessoais.dat";
$mailprog = '/usr/sbin/sendmail';
$search_for = "a";
$search_field = "all";
&search_database($pessoais,$search_for);
$count = @results;
...
...
foreach $results (@results){
($key,$descricao,$inscricao,$mensalidade,$codIBM,$qid) = split(/
+\|/,$results);
print MAIL "$descricao $FORM{$qid}\n\n";
}
...
I'm not sure what you mean by "the script only considers the value of the data file in the mail." Can you give us an example of what you think it should be doing, and what it actually is doing?