Hello Perl Gurus,
I'm trying to write a program that will merge two hashes together onto a
third hash called %h3. I need to
return a reference to %h3 to the main program and print each of the values
of the hash %h3 using the arrow notation.
Name of the actual function performing the merge
one : 1
six : 6
three: 3
two : 2
Wags ;)
-Original Message-
From: AMORE,JUAN (HP-Roseville,ex1) [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 03, 2001 10:09
To: Beginners@Perl. Org (E-mail)
Cc: 'Maxim Berlin'
Subject: merging two hashes together?
Hello Perl
Hello Wagner-David,
Saturday, November 03, 2001, Wagner-David [EMAIL PROTECTED] wrote:
WD Here is one shot, though I changed some of the constants:
WD #!perl -w
my %h1 = (one = 1, two = 2, three = 3);
my %h2 = (four = 4, five = 5, six = 6);
WD my %h3 = ();
WD mergehash( \%h1,
In the example you provide, this will work:
-START
%h1 = (one = 1, two = 2, three = 3);
%h2 = (four = 4, five = 5, six = 6);
# Note that the '' on function calls is optional, unlike $, @, and %
$ref_h3 = mergehash(_, _);
sub mergehash {
my ($rh_first,