Gossamer Forum
Home : General : Perl Programming :

Re: [delicia] return two arrays from a sub

Quote Reply
Re: [delicia] return two arrays from a sub In reply to
You can do it by making them arrayrefs:

Code:
my ($par,$whandicap) = &get_par_for_course;
foreach (@$par) {
....
}

foreach (@$whandicap) {
....
}
...or you can reference them:

Code:
my ($par,$whandicap) = (@$par,@$whandicap)



Code:
sub get_par_for_course {
# --------------------------------------------------------
# lookup course and get par for each hole


&switch_to_courses;

my (%course) = &get_record2('1'); # always berkeley hills = #1


my (@par) = split (/:/, $course{'WPar'});
my (@whandicap) = split (/:/, $course{'WHandicap'});

return(\@par,\@whandicap);


}

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread return two arrays from a sub delicia 2021 Jun 30, 2021, 12:38 PM
Post Re: [delicia] return two arrays from a sub
delicia 1991 Jun 30, 2021, 12:49 PM
Post Re: [delicia] return two arrays from a sub
Andy 1969 Jul 6, 2021, 1:00 AM