The latter is actually a lot clearer. It is easier to see that the top of the "loop" might have control transfered to it. It is easier to determine where the goto is sending control than to where the redo is going

But that's only because you used a label in the goto code. That's why I used a label in my redo code even though it wasn't required. I must admit I forgot to place the place the label on the actual redo like I normally do, but I meant to. I use redo just like I would use goto. The only difference is that the word redo conveys the reason for which I am jumping.

By the way, you inverted the condition in your second last snippet. It should read last if success; to be equivalent.


In reply to Re^4: Re Execute Lines of Code ("loops") by ikegami
in thread Re Execute Lines of Code by btobin0

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.