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 . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/