|P is for Practical|
Where to put self-made loop logic (separate module)?by basic6 (Novice)
|on Dec 28, 2012 at 22:59 UTC||Need Help??|
basic6 has asked for the
wisdom of the Perl Monks concerning the following question:
I wrote a function that loops through a scalarref line by line in order to make some modifications (in-place), because I was unable to find a Perl feature for that.
So I'd find it interesting if somebody had a simple solution for that trivial task, but my question is:
How could I put this self-made loop (based on a while loop) into a separate package so I can use it to do all kinds of modifications per line?
If that thing was a class, I could instantiate an object but I wouldn't know how to wrap such an object around the individual code which is responsible for the line modifications?