Re: Calling a subroutine within a conditionalby GrandFather (Sage)
|on Sep 04, 2012 at 00:35 UTC||Need Help??|
There look to be a bunch of things there that will make the code hard to understand and maintain.
First off, don't use prototypes. That is your immediate problem as has already been suggested. They don't do what you think and cause subtle trouble that can lead to really hard to debug errors.
Don't use artificial boolean values. Just accept that $continue_tag is a boolean variable that is false if it is empty or 0 and true otherwise.
Make it clear where information comes from. You don't show @array_of_lines (bad name btw, why not just @lines?) being assigned any content. It's not clear how the work look_through_file does relates to the work create_output does. Where does $continue_tag's value get changed?
Without any idea what your intent for the code is I can only sketch a better structure, but consider:
which batches lines from a file into groups of 10 non-blank lines then prints each group with a group prefix.
True laziness is hard work