Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

Parsing Arrays between Modules

Quote Reply
Parsing Arrays between Modules
I'm having trouble parsing array values from one custom module to another.

In my custom module1package, I have the following -

use Dbsql::module2package;
my @addresses=Dbsql::module2package::sub_name($variable_1,$variable_2);

In my custom module2package, I have the following -

return @addresses;

I have tested module2package and @addresses at this point contains two values (e.g Hello, Goodbye)
but @addresses in module1package only contains the number 2 (which I assume is refering to the number of items stored). Why aren't the values being parsed?

I'm sure this is a very small problem with a simple solution that I am overlooking.
Can anyone help me out?
Thank you.

Last edited by:

jai: Feb 21, 2005, 7:46 PM
Quote Reply
Re: [jai] Parsing Arrays between Modules In reply to
OK, I got it.
My stupid mistake. The array was being returned to another sub within the module and that sub was referencing it as a scalar.
Because I didn't provide the complete modules, it would have been very difficult for anyone to have worked out the problem.
At least I learnt how to use the wantarray function during this exercise -
return wantarray ? @addresses : "Error: scalar context";

Last edited by:

jai: Feb 22, 2005, 4:19 AM