in reply to Re^2: Wrong calculations in for loop
in thread Wrong calculations in for loop
Or even simpler, just change the print to printf
my $zmax = 60; # Maximum depth in your model my $dz = 0.05; # Grid spacing in z-direction for (my $i=0; $i <= $zmax; $i = $i+$dz) { printf("%.2f\n", $i); }
|
---|
In Section
Seekers of Perl Wisdom