Jonathan Vandine wrote:
>
> I am trying to pass to hashes to a subroutine and combine into one hash.
> Then return that hash as a reference to the main program. Then print the
> result of new hash.
>
> %h1 = ("key1" => value1);
> %h2 = ("key2" => value2);
> $rnew = &mergehash(\%h1, \%h2);
> sub mergehash{
> %h3 = @_;
> return \%h3;
> }
> print $rnew->{key1};
sub mergehash {
return { %{$_[0]}, %{$_[1]} };
}
my %h1 = ( key1 => 'value1' );
my %h2 = ( key2 => 'value2' );
my $rnew = mergehash( \%h1, \%h2 );
print $rnew->{key1};
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]