harryC has asked for the wisdom of the Perl Monks concerning the following question:
thks for your help#!/usr/bin/perl -w use strict; my %test1; my %test2; my $k; (%test1,%test2) = &testsub; foreach $k (sort keys %test1) { print " test1 $k $test1{$k}{'type'} $test1{$k}{'value1'}$test1{$k}{'v +alue1'} \n"; } foreach $k (sort keys %test2) { print " test1 $k $test2{$k}{'type'} $test2{$k}{'value1'}$test2{$k}{'v +alue1'} \n"; } sub testsub { my $hasrows=0; my %test1; my %test2; while ($hasrows < 5) { $test1{$hasrows} = { 'type' => "type-test-$1hasrows", 'value1' => "value1-test1-$hasrows", 'value2' => "value2-test1-$hasrows" }; $hasrows +=1; } $hasrows=0; while ($hasrows < 8) { $test2{$hasrows} = { 'type' => "type-test2-$hasrows", 'value1' => "value1-test2-$hasrows", 'value2' => "value2-test2-$hasrows" }; $hasrows +=1; } return (%test1,%test2); }
20071029 Janitored by Corion: Changed </br> tags to <br/> tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: can i return two hashes from a soubroutine
by ikegami (Patriarch) on Oct 25, 2007 at 21:27 UTC | |
|
Re: can i return two hashes from a soubroutine
by jdporter (Paladin) on Oct 25, 2007 at 20:38 UTC | |
|
Re: can i return two hashes from a soubroutine
by thezip (Vicar) on Oct 25, 2007 at 20:44 UTC | |
|
Re: can i return two hashes from a soubroutine
by toolic (Bishop) on Oct 25, 2007 at 20:45 UTC |