Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

PERL Question - Arrays and Hashes


  • Please log in to reply

#1
Flint

Flint

    Member

  • Member
  • PipPip
  • 32 posts
What i'm trying to do is modify some existing code for the way my company's server connects to Bugzilla. The code uses a file called "params" which is nothing but one long hash, but all of the existing elements are scalar, so it looks something like this:
%param = (
		   'LDAPbaseDN' => 'dc=company',
		   'LDAPstarttls' => 0,
		   'LDAPuidattribute' => 'uid',
		   'allow_attach_url' => 0,
		   'allow_attachment_deletion' => 0,
		   'allowbugdeletion' => 0,
		   'allowemailchange' => 0,
		   ...etc...
	   );
Then the perl file that i'm using calls to one of these elements with something like this:
$baseDN = Bugzilla->params->{"LDAPbaseDN"};
so that $baseDN = "dc=company". I know this syntax is correct, because the code works as it should. What I want to do is add a new element to that hash which is a list of strings, such as the names of groups of employees, so that when I do something like the following in my code, I reference to that list of groups:
@groups = Bugzilla->params->{"LDAPgroups"};
Say I have group1, group2, and group3. How do I list them as one element in the %param hash? And how would I implement this array in a loop in my code?
  • 0

Advertisements







Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP