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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||