in reply to Comparing two hashes-help
First of all, you should know that in this forum, you can be sure to be treated respectfully. No matter how “new to Perl” you might or might not be. This is a gathering-place of professionals.
Second... I often find it useful to describe logic like this in terms of a finite-state machine (FSM). The idea here is actually a simple one, despite the obfuscatory-sounding name. It works like this:
You say that the algorithm (“machine”) can be “in” one of several “states” based upon its recent history. (By definition, it always begins its life in some “initial” state.)
The main program is just a loop. Each time through the loop, the program:
- Based on the current state, and whatever is presented to it at this time, it chooses the next state to be in.
- Then, it carries out some action appropriate to that new state.
- The program continues in this way until it reaches a “stop” state.
So, to continue my extemporaneous-design exercise a bit farther, the algorithm could start in state SKIPPING_FOR_IDENTICAL_VALUES and, when it finds one, switch to LOOKING_FOR_BLANK_IN_FILE_1. It would continue until it finally reached a stop-state of END_OF_BOTH_FILES_REACHED. (I hope...) you get the idea from this barest of sketches, which by the way is not specific to Perl.