Ken, your mixing your @ with your %
Try this:
#!/usr/bin/perl
&GetMarmots;
sub GetMarmots {
%result = ();
$result{'steppe marmot'} = 4;
$result{'himalayan marmot'} = 3;
$result{'mongolian marmot'} = 1;
$result{'woodchuck'} = 6;
return %result;
}
foreach (keys %result) {print "$_\n";}
print "\n";
On Sat, 2003-05-31 at 21:24, Ken Tozier wrote:
> I'm sure this is an easy one but after Googling for hours, I still
> don't get it. Given the following subroutine, how do I return the
> result array? Nothing I try works.
>
> sub GetMarmots
> {
> @result = ();
> $result{'steppe marmot '} = 4;
> $result{'himalayan marmot'} = 3;
> $result{'mongolian marmot'} = 1;
> $result{'woodchuck'} = 6;
>
> return @ result;
> }
>
> Thanks in advance,
>
> Ken
>