in reply to Parsing structured text, problem with parsing logic

Try it this way:

#! perl -slw use strict; use Data::Dump qw[ pp ]; my %config; while( <> ) { chomp; my @bits = split '[:|=]'; my $ref = \%config; $ref = $ref->{ shift( @bits ) } //= {} while @bits > 2; $ref->{ pop @bits } = pop @bits; } pp \%config;

Produces:

C:\test>969796.pl 969796.dat { "cfs_online_timeout_changes" => 200, "max_configured_packages" => 100, "max_reformation_duration" => 300, node => { nodeA => { interface => { lan900 => { ip_address => { IP_A => +{ name => "IP_A", netmask => "255.255.255.0" } }, name => "lan900", status => "up", }, lan901 => { ip_address => { IP_C => +{ name => "IP_C", netmask => "255.255.255.0" } }, name => "lan901", status => "up", }, }, name => "nodeA", status => "up", subnet => { SUBNET_A => { name => "SUBNET_A", st +atus => "up" }, SUBNET_B => { name => "SUBNET_B", st +atus => "up" }, }, }, nodeB => { interface => { lan900 => { ip_address => { IP_B => +{ name => "IP_B", netmask => "255.255.255.0" } }, name => "lan900", status => "up", }, lan901 => { ip_address => { IP_D => +{ name => "IP_D", netmask => "255.255.255.0" } }, name => "lan901", status => "up", }, }, name => "nodeB", status => "up", subnet => { SUBNET_A => { name => "SUBNET_A", st +atus => "up" }, SUBNET_B => { name => "SUBNET_B", st +atus => "up" }, }, }, }, }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?