... replacing all C style loops ...

I would urge you to approach this with caution. C-style loops have their uses, and it is not always advantageous or appropriate (or even possible) to replace such a loop with a Perl-style loop.

I actually never used any perl style loops before other than foreach my $i ( ... );

It's important to realize that the keywords for and foreach are exactly equivalent and completely interchangeable in any such statement. The different behaviors of the two different loop styles are entirely determined by whether the loop is written with an init/test/final block (C-style) or a list (Perl-style). Please see For Loops (which discusses C-style loops) and Foreach Loops (which discusses Perl-style loops), both in perlsyn. Again, regardless that the two different loop styles are discussed in sections clearly labeled "For" and "Foreach", respectively, the two keywords are completely interchangeable. (And then, of course, there's the statement modifier form!)


Give a man a fish:  <%-{-{-{-<


In reply to Re^5: problem with TK, tag, passing param with binding, destroying binds by AnomalousMonk
in thread problem with TK, tag, passing param with binding, destroying binds by jsteng

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.