in reply to Parsing a file comprising blocks and comparing the blocks

I do not understand why it is necessary to distinguish between two different blocks. does "appropriate" mean that the block_ids must be the same? if yes, why not
# A type A block block_id=1 magic=true unlikeliness=2 colour=green warty=false horns=1
It would simplify the parsing. Otherwise (I assume you then compare the blocks pairwise), then your array of hashes approach seems to be the best choice. Maybe some of the myriad of Config::* modules on cpan could help.

Replies are listed 'Best First'.
Re^2: Parsing a file comprising blocks and comparing the blocks
by loris (Hermit) on Aug 15, 2006 at 12:29 UTC

    The separation into different block types is because there are far fewer of Type A than of Type B. Thus, the actual test cases could be:

    A1-B1 A1-B2 A1-B3 ... A1-B99 A2-B1 ... A2-B999

    So the blocks types form a hierarchy. I hope that makes the problem clearer.

    In any case, thanks for the hint about the Config::* modules - I hadn't been aware of them.

    loris


    "It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ."