--- [EMAIL PROTECTED] wrote:
> The code fragment below is the bit I'm having issues with. I know
> that everything works as the commented print stmts work. When I try
> to return the value to the calling script I seem to be getting a
count
> of the elements of the array.
That sounds like a context problem....
> sub sumSales{
[snip]
> my (@row) = $sth->fetchrow_array();
Ok.
[snip]
> if (@row){return @row};
er. The if is superfluous. If the list is empty, return it anyway. =o)
> }
>
> The sub is called like:
>
> my @sales = myMod::sumSales(@arg)
> || die "Unable to complete sumSales routine: $!\n";
try or instead of ||.
> The doco about return says "The supplied expersion will be evaluated
> in the context of the subroutine invocation. That is, if the
> subroutine was called in a scalar context , EXPR is also evaluated in
> a scalar context. If the subroutine was invoked in a list context
> then EXPR is also evaluated in a listcontext and can return a list
> value."
func() || die
Is a scalar context, isn't it?
*Then* the return from that gets stored....
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/