in reply to Basic DNS Record Creation
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:
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.{ 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; }
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Basic DNS Record Creation
by CiceroLove (Monk) on Feb 06, 2001 at 21:49 UTC |