perl

Bill Jones bill at fccj.org
Fri Mar 26 09:22:44 CST 1999


On the Jax.PM jacksonville-pm-list 1.94.4;
"Bill Jones" <bill at fccj.org> wrote -

>From: Daniel Stringfield <dstringf at fccjmail.fccj.cc.fl.us>
>To: bill at fccjmail.fccj.cc.fl.us
>Subject: perl
>Date: Fri, Mar 26, 1999, 9:56 AM
>

> Hey, how do you add more hash references to a pre-existing hash table?
>
> I tried it like:
> %adminlist = (%adminlist, $row[0] => $row[1]);
>
> But it doesn't like that line.
> Any suggestions?
>
> I was thinking about building 2 arrays, and then something
> like:
>
> push(@adminlist, $row[0]);
> push(@adminlist2, $row[1]);
>
> --
> ======= 40 4B 36 58 A0 C7 5A 8A  49 E0 39 54 00 20 A3 AA =======
>             Daniel Stringfield  <dstringf at fccj.org>
>            Florida Community College at Jacksonville
> ================================================================
>
>
>

Hi :]

Please CC the JaxPM list  ( jacksonville-pm-list at hfb.pm.org )
for all Perl-centric questions; we are developing an archive.


How do I add a new element to a hash?  Good question!

The 'Perl Cookbook' page 130, Section 5.1
'Adding an Element to a Hash' states:

$HASK($KEY) = $VALUE;


Also, your second intent -

How do I merge two hashes?  Page 145 states:

%merged = (%A,%B);  # Is prolly what you want...

The PUSH function is best used to append two (or more) arrays
together; like:

push (@array1, @array2);


HTH,
-Sneex-  :]
________________________________________________________________________
Bill Jones  |  FCCJ Webmaster  |  http://www.fccj.org/cgi/mail?webmaster
FCCJ  |  501 W State St  |  Jacksonville, FL 32202  |  1 (904) 632-3089

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax at jacksonville.pm.org

The Jacksonville Perl Monger's Group is operated by -
Bill -Sneex- Jones ( sneex at usa.net ),
to whom send all praises, complaints, or comments...




More information about the Jacksonville-pm mailing list