Having selected the link of "Comment on...", I feel obliged to comment on this program after a cursory glance as follows.

I find your introduction of the synthetic variable $control to be very confusing to follow. I had to read that loop three times to figure out when you were getting out to verify that it was doing what the text said it was doing. I think you want this general idiom:

{ print "value for XYZ? "; chomp($xyz = <STDIN>); unless (validate $xyz) { print "$xyz is not a valid XYZ\n"; redo; } print "confirm value $xyz for XYZ? (y/n)"; redo unless <STDIN> =~ /^y/i; }
In fact, you can bundle this up as a subroutine, and it'd make even more sense. If you ever find yourself typing the same code two or three times, except for some parameters (used in its most generic sense here), it's a good candidate for factoring out. I heard somewhere once "put the regular part as code, and the irregular part as data". And that really makes sense.

-- Randal L. Schwartz, Perl hacker


In reply to Re: Basic DNS Record Creation by merlyn
in thread Basic DNS Record Creation by CiceroLove

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.