Hey, When I do that I get the following output:
p...@host:~/webFTP> perl web* Content-Type: text/html Username = HASH(0x8113c28) What is that? Thanks! -----Original Message----- From: Shlomi Fish [mailto:shlo...@iglu.org.il] Sent: Friday, March 26, 2010 9:10 AM To: beginners@perl.org Cc: Pry, Jeffrey Subject: Re: Storing a Hash Inside An Array Hi Jeffrey, On Friday 26 Mar 2010 15:36:46 Pry, Jeffrey wrote: > Hey, > > First off let me say that this mailing list is great! It is nice to be able > to see the collaborative effort that everyone puts in when one of us has a > question or issue. Thank you! > > Now, I was wondering if it would be possible to store a hash inside of an > array. I would like to have an array called @settings and a hash inside of > that containing the settings for each array item. Ideally the @array would > contain a hash at @array[i] where settings such as 'ftpserver' = I should note that it's $array[$i] - not @array[i]. > localhost, 'password' = p...@$$word, etc. I want to do this so I can separate > records in the array and call them only if needed and also to make it > easier to add additional entries in the future to my application. > You need a hash reference. For introductions to references see: http://perl-begin.org/topics/references/ For example you can do (untested): {{{ push @array, { username => $username, password => $password, bio => $bio, }; # Later on. foreach my $elem (@array) { print "Username = ", $elem->{username}, "\n"; } }}} Regards, Shlomi Fish > Thanks in advance for all of your help! It is much appreciated, > > - Jeffrey Kevin Pry > -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ First stop for Perl beginners - http://perl-begin.org/ Deletionists delete Wikipedia articles that they consider lame. Chuck Norris deletes deletionists whom he considers lame. Please reply to list if it's a mailing list post - http://shlom.in/reply . IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/