Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
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