If the program returned 5 lines the first time, and only 2 the next, won't there be lines left over from the first time?
Actually, despite what others here may have said, you do not have to worry about anything. Unlike traditional languages, an array in Perl is not just a name for a series of consecutive memory addresses (just like scalars are not just names for single memory addresses); it is a smart data type (again, scalars are too) which may grow and shrink, moving about in memory as circumstances demand etc. It does what traditional languages require you to implement linked lists for, and more.
The whole point of this explanation:
1 2 3
Perl does the nitty gritty of keeping things clean for you. Garbage collection, undef
, references being smart unlike pointers, and so and so forth..
Makeshifts last the longest.