Well, that's definitely progress, and your code looks a lot better, though I recommend re-reading and understanding the latter portion of my previous post so that you can re-work your greps.
But back to your modified problem: If your code now runs, but just doesn't output what you're expecting it to, it's time to pull out the age-old debugging tool: print. Pepper your code with print statements that output the current state of various variables, which logic paths you followed, and when you're inside of loops... that sort of thing. The actual Perl debugger could be helpful, but it's harder to learn. For a short script like yours, the shortest learning curve is to just sprinkle print statements all over the place.
The idea is to look at a line of your code and think up an assertion: "I believe that before this line @something contains X, and after this line of code, @something contains that." Now put a print statement before and after demonstrating that assertion, as well as whatever variables contribute to creating the change. Run your code. Watch your assertions do what you expect, or fail. When they fail, hopefully the print statements will give you enough of a clue regarding the failure that you can figure out why it's failing.
Dave
In reply to Re^2: Question of scope and syntax
by davido
in thread Question of scope and syntax
by Hellhound4
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |