in reply to parsing a config file

Or you could use this far from elegant solution:

while (<DATA>) { print if /^QueueManager:$/ .. /^QueueManager$/; }
(note no colon on the RHS)

d

Replies are listed 'Best First'.
Re: Re: parsing a config file
by TomDLux (Vicar) on May 22, 2003 at 04:14 UTC

    So the RHS never matches, which works because the desired section is at the end of the file. But what if someone sets some configuration value which causes a new section if the config file, or cause the QueueManager sections to become the first instead of the last?

    I don't see anything elegant about that. Please explain?

    Tom

      Sorry if my semi-joke led to misunderstanding. If you read my message again, you will see that I actually describe my solution as "far from elegant", which means pretty much the opposite of elegant.

      In Real Life, I think that this thread could have finished after answer #1 :-)

      d

        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".
        When I see "far from", I will not read "far more".