Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Matching String Value with Hash Key

by Mark.Allan (Sexton)
on Sep 29, 2013 at 10:22 UTC ( #1056205=note: print w/replies, xml ) Need Help??


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

Ken

Thanks for your input, I'll pick up on this tomorrow but 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

The exact file looks likes this

DEPLOY : SWG_Lower HOLDS SWG_Depot EQUALS:= total_dist: completion= SUCCESS total_finish: completion= SUCCESS total_cancel:completion=SUCCESS DEPLOYED DEPLOY: LOADED_Lower HOLDS SWG_Depot EQUALS:= total_finish: completion= SUCCESS total_cancel: completion=SUCCESS DEPLOYED DEPLOY: CONFIG_Lower HOLDS SWG_Depot EQUALS:= total_cancel: completion=SUCCESS DEPLOYED DEPLOY first_distribution HOLDS LOADED_Lower DEPLOYED DEPLOY: second_distribution HOLDS CONFIG_Lower ; DEPLOYED DEPLOY : third_distribution HOLDS LOADED_Lower; DEPLOYED DEPLOY : forth_distribution HOLDS SWG_Lower ; DEPLOYED

Replies are listed 'Best First'.
Re^3: Matching String Value with Hash Key
by kcott (Chancellor) on Sep 30, 2013 at 05:36 UTC
    "... 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

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

      thanks again,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056205]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-08-18 01:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (184 votes). Check out past polls.

    Notices?