Re: equivalent controls
- From: "Jürgen Exner" <jurgenex@xxxxxxxxxxx>
- Date: Thu, 29 Nov 2007 03:52:37 GMT
Wade Ward wrote:
[...]
do {{[...]
$x_calc++;
$power++;
last if $x_calc > 10;
print STDOUT "x calc is $x_calc\n";
print STDOUT "x_calc out is $x_calc\n";
print STDOUT "power out is $power\n";
do {{
$power++;
$x_calc++;
print STDOUT "power in is $power\n";
print STDOUT "x_calc in is $x_calc\n";
$x_sought = $x_sought - 1;
last if 1 > 0;
print STDOUT "x sought is $x_sought\n";
}} until $x_calc > 7.5;
$x_calc = $penultimate;
}} until ($power > 6);
Is there a slicker way to do this in perl than using the double curly
braces?
Absolutely, here it goes for your main loop:
while ($power < 6 and $x_calc < 10) {
$x_calc++;
$power++;
print "x calc is $x_calc\n";
print "x_calc out is $x_calc\n";
print "power out is $power\n";
while ($x_calc <= 7.5 ){
$power++;
$x_calc++;
print "power in is $power\n";
print "x_calc in is $x_calc\n";
}
$x_calc = $penultimate;
};
It also reduced the number of lines from 20 to 14 and IMHO is much more
readable, too.
jue
.
- Follow-Ups:
- Re: equivalent controls
- From: Wade Ward
- Re: equivalent controls
- References:
- equivalent controls
- From: Wade Ward
- equivalent controls
- Prev by Date: Re: parsing a mbox file in PERL
- Next by Date: making the keys of a hash from parameters collected from a form
- Previous by thread: equivalent controls
- Next by thread: Re: equivalent controls
- Index(es):
Relevant Pages
|