Hi,I'm trying to return an array and a variable from a subroutine,but I'm unable to get the desired output,please help me in correcting the code below

my ( @subs, $SubId ) = getsubsFromAcct( $currAcct ); my $length = @subs; print ("No of subs : $length and subs are @subs"); sub getsubsFromAcct { my $acctNum = shift; my @subs = (); my ( $sbscrpId, $count ); my $getSbscrp_id = $lda->prepare("select sbscrp from sbscrp_cltn w +here acct_nbr = ? "); my $subsOfSbscrp = $lda->prepare("select distinct subs_time from s +bscrp_time where sbscrp = ? "); $getSbscrp_id->bind_param(1,$acctNum); $getSbscrp_id->execute(); $getSbscrp_id->bind_col(1,\$sbscrpId); if ( $getSbscrp_id->fetch) { $subsOfSbscrp->bind_param(1,$sbscrpId); $subsOfSbscrp->execute() while ( my @subRow = $subsOfSbscrp->fetchrow_array() ) { push(@subs,@subRow); } } return ( \@subs, \$sbscrpId ); }
The output I got is :
No of subs : 2 and subs are ARRAY(0x2f8d10) SCALAR(0x2f8cf8)

In reply to Returning multiple values from a subroutine by rkrish

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.