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
The output I got is :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 ); }
No of subs : 2 and subs are ARRAY(0x2f8d10) SCALAR(0x2f8cf8)
In reply to Returning multiple values from a subroutine by rkrish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |