Your reply indicates a number of misunderstandings. I hope
you don't mind my pointing them out as a learning exercise.
Now a few other general comments about the problem. First
of all your removal of the hardcoded 45 is a good thing.
Hard-coded numbers are a danger sign. Secondly
it is a good habit to make everything run with
,
which none of this code does. For short examples the
benefits are not that great. Longer code is a different
story. Thirdly I have to wonder whether it really makes
sense to append together lines which have whitespace
stripped from front and back to each other without some
space to divide them. And finally, is $nl being printed?
I don't see it being printed, and if it isn't, then the
entire script becomes of dubious value at best.