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>

In reply to Re: Small Doubt Regarding Select Staement in DB by rovf
in thread Small Doubt Regarding Select Staement in DB by koti688

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.