in reply to Returning multiple values from a subroutine
You are returning a reference to an array, which is a scalar value.
So you need to expect a scalar, and then de-reference it to get at the array values.
Prints:#!/usr/bin/perl use strict; use warnings; my $currAcct = 1; 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 = 4; @subs = qw| 2 3 4 5 |; return ( \@subs, \$sbscrpId ); }
No of subs : 4 and subs are 2 3 4 5
Hope this helps
Darren
|
---|
In Section
Seekers of Perl Wisdom