in reply to Sub routine processing issue, HELP!!!!!

You are not returning any value from &total(@array) and the &total; call gives @_ as the arguments to &total (not an empty list, and definitely not @array)

Furthermore, in your example @array only ever contains one element ($N_NUM), so you'd just as well call it as total($N_NUM);

try removing the first &total(@array) call, and replace the &total call with

my $result = total($N_NUM);
and change the return statement in total() with
return $results;
and please STOP SHOUTING! see how (not) to ask a question.

Thank you.

Replies are listed 'Best First'.
Re^2: Sub routine processing issue, HELP!!!!!
by dazzle (Sexton) on Dec 08, 2004 at 22:52 UTC
    Why don't you just take advantage of auto-vivification to generate hash keys and returning the value from your subroutine?

    Something like:

    sub total { my ($N_NUM) = @_; # expression is obviously pseudo-code if ($N_NUM is in database) { return 'FOUND'; } return 'NOT FOUND'; } my %dblist; $dblist{"$N_NUM"} = total($N_NUM); foreach my $item (sort keys %dblist) { # print table row print $item; print $dblist{"$item"}; }
    (edit: didn't really understand the question the first time, and am still not sure if I understand it.)
Re^2: Sub routine processing issue, HELP!!!!!
by Anonymous Monk on Dec 08, 2004 at 20:51 UTC
    I didn't know about SHOUTING, but back to the code,
    I already tried to replace, &total(@array) with &total($N_NUM), but I will sometimes have more than one value, I think for that reason I do need to use what I have, like,
    push @array,$N_NUM;