Congratulations, you're getting closer :)
Your if logic is clear now, and correct, you're almost finished
But, your code once again does not compile, and has not been tidied, and you're still not push-ing onto the array
You attempt to compensate by using an index, but you're using it on the wrong variable
- strict tells you about this
- Global symbol "@lin" requires explicit package name
- Global symbol "@arr" requires explicit package name
There is no @lin array, and @arr does not exist outside of the if block, where you assign to it, instead of pushing
You need to increase the scope of @arr, by declaring it outside the while loop, the same as you did $fg
You need to push $lin onto @arr
Unsure of what i'm talking about? You should read the basic datatypes, three, Arrays: A Tutorial/Reference, Lexical scoping like a fox
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:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.