SPUG: parsing a config file
El JoPe Magnifico
jope-spug at n2h2.com
Tue Jan 11 14:22:32 CST 2000
On Mon, 10 Jan 2000, Scott Blachowicz wrote:
> On Mon, Jan 10, 2000 at 06:13:56PM -0800, Todd Wells wrote:
>> Well, this method has worked out great, but I'm having a problem
>> as a result of this parentheses/square brackets issue.
>> Here's the deal, if I feed this data to the routine:
>> Domain = {
>> servers = (beluga,toddw2,150.215.141.11);
>> status = Enabled;
>> };
>>
>> Then I get this data structure:
>>
>> $config = HASH(0x2ff098)
>> 'Domain' => HASH(0x282a0c)
>> 'servers' => 'beluga'
>> 'status' => 'Enabled'
>> 'toddw2' => '150.215141.11'
[...]
>> Would it better if I turn those parens into brackets?
>> Or do you have some other trick up your sleeve?
>
> Turning them into brackets would turn the contents into an anonymous
> reference to a hash (curly braces) or an array (square brackets)...
> and that's not what you want.
I'm assuming this is in reference to the 'servers' field above.
An anonymous array reference (a la square brackets) _is_ what you want.
That's how you nest an array/list inside another data structure in perl.
Apologies if I'm misunderstanding your response, Scott.
-jp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list