Welcome to the Monastery.

It depends how fluent you wish to be - how much you wish to sound like a "native".

The c-style loop you used is fine, it gets the job done, but it is C written in perl. It would be similar to my trying to speak Spanish to a native speaker. I could convey meaning (hopefully the correct meaning), but would in no way be considered fluent. In some cases (transferring English idioms into Spanish, for example), I would only be understood by someone that could follow how I got to the translation I used.

If I were to immerse myself in the language, I would hope that I would become more fluent, and stop trying to use English idioms in was that do not make sense. I might even start using Spanish idioms effectively.

It comes down to communicating ideas. As you start to use the idioms and base your communication on the language at hand, you can be more effective at transferring your ideas to others.

Many times when one comes into Perl from another language, that person will write their other language in Perl. It isn't wrong to use the c-style loop, there are just more perlish ways to do it.

I am also not saying that you should never use the c-style loop. There are times when it would be more appropriate than the for/foreach loop above.

--MidLifeXis


In reply to Re^4: Useless use of private variable in void context by MidLifeXis
in thread Useless use of private variable in void context by okarmi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.