in reply to Small Doubt Regarding Select Staement in DB

my @row; while (@row = $sth1->fetchrow_array) { print "@row \n"; }
i want to get the ouput using "return" function and using "array of arrays".

Hmmmm.... you are nearly done. Inside the loop, you already have the data as an array. Though you can't exactly have "array of array", you can at least have either "array of arrayreference" or "reference to array of arrayreference", depending on your likings (or maybe depending on the calling context). If you define your result array initially as

my @resultarray;
you can successively push references to the rows into it, like this:
push @resultarray,\@row;
Then you can do one of these:
return @resultarray; # returns list when called in list context return \@resultarray; # returns reference return wantarray ? @resultarray : \@resultarray; # adapt to calling co +ntext
Although I personally use the latter type of return occasionally in my own code, I know that this usage is somewhat questionable, and at least needs to be documented well.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^2: Small Doubt Regarding Select Staement in DB
by koti688 (Sexton) on Nov 03, 2008 at 12:03 UTC
    Thanks Ronald.. I got it.. and i really appreciate ur explanation 2. Thanks a lot ~ koti.