in reply to Re^2: Perl starter with questions about processing data from a txt file
in thread Perl starter with questions about processing data from a txt file

The code reports the remembered value when D > 1e-3, to the actual C value. As it is, it will report all the values. If you want to report only the first one, just exit the loop via last after printing a value. If you want to skip values that are on the neighbouring lines, just set a flag once you output a value, clear it otherwise, and only report a value if the flag is not set.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re^3: Perl starter with questions about processing data from a txt file

Replies are listed 'Best First'.
Re^4: Perl starter with questions about processing data from a txt file
by willperl (Initiate) on Jan 17, 2013 at 22:51 UTC
    Thanks choroba! I played with the code and understand what you meant by saying "remembered" value. Still trying the "last" perl function but when I added it instead of giving me only one result my code returned nothing... Thanks again for your help!
Re^4: Perl starter with questions about processing data from a txt file
by willperl (Initiate) on Jan 17, 2013 at 23:00 UTC
    Oops~~ I added some conditions after the last command and was able to exit the while loop using last as recommended. Thanks again choroba!