in reply to Re^2: Matching String Value with Hash Key
in thread Matching String Value with Hash Key

"... one thing I failed to highlight is that ###parent config#### and #####child config##### don't actually exist in the file, it's was merely me defining the structure which I forgot to mention"

You actually wrote:

"I have the following text file of configuration details."

It's important to pay attention to details. I can only provide advice on dealing with the input you describe: I can't guess that some of what you provide is correct and other parts are not. Furthermore, the computer can only deal with the input (as you describe it) in your code; for instance, any attempt to match either version of the input with the pattern '#parent config#' would fail.

You may think I'm being pedantic; however, if you look back to the issues I originally raised, you'll see that all six of them are related to a lack of attention to detail.

For your latest version of your input, you can modify my code by changing

$gen = 'child' if /CHILD CONFIG/;

to

$gen = 'child' unless /EQUALS/;

and get the same output values.

-- Ken

Replies are listed 'Best First'.
Re^4: Matching String Value with Hash Key
by Mark.Allan (Sexton) on Oct 01, 2013 at 17:39 UTC

    ken, apologies for the sloppy post but its sorted now and your assistance was invaluable as ever

    thanks again,