in reply to Re: foreach nightmare!
in thread foreach nightmare!

Hi, It looks something like this:
Well Derivative Data (Reading 1...N) + + + + + + + + 1 -0.0534 -0.0423 -0.0148 -0.0056 0.0074 0.0235 0 +.0296 0.0225 0.0431 0.0377 0.0495 0.0496 0.0477 +0.0545 0.0594 0.055 0.0696 0.0751 0.0597 0.0452 +0.0419 0.0449 0.0578 0.0658 0.0777 0.0926 0.0784 + 0.0693 0.0642 0.0685 0.0697 0.0736 0.0691 0.0667 + 0.058 0.0508 0.0538 0.0621 0.0737 0.0785 0.0783 + 0.0687 0.0581 0.0546 0.0559 0.0607 0.0718 0.0765 + 0.0688 0.067 0.0644 0.0707 0.0776 0.085 0.0864 + 0.1129 0.1922 0.3194 0.4269 0.4617 0.4155 0.3037 + 0.1595 0.0428 -0.0078 0.0033 0.0275 0.0299 0.030 +4 0.0315 0.0301 0.0278 0.0302 0.0283 0.0354 0.03 +63 0.0373 0.04 0.0406 0.0396 0.0394 0.0412 0.044 +4 0.0587 0.0842 0.1232 0.1616 0.1877 0.1871 0.15 +79 0.1125 0.0627 0.025 0.0021 -0.0055 -0.0047 -0 +.001 -0.0015 -0.0006 0.0019 0.0012 0.0002 -0.0003 + 0.0001 0.0009 0.0008 -0.0003 0.0006 0.0009 -0.000 +3 0.0011 0.0008 -0.0001 0.0007 -0.0008 -0.0004 0 + -0.0004 -0.0007 0.001 0.0002 0.0014 0.0013 0.00 +03 0.001 -0.0001 -0.0004 -0.0006 -0.0013 -0.0011 2 -0.0524 -0.0357 -0.0081 0.0061 0.0159 0.0226 0. +024 0.03 0.0339 0.0376 0.041 0.0477 0.0521 0.054 +4 0.0562 0.0568 0.065 0.0642 0.0621 0.0584 0.058 +9 0.064 0.0625 0.0649 0.0637 0.0703 0.068 0.0659 + 0.068 0.0754 0.0763 0.0722 0.0656 0.0655 0.0645 + 0.0646 0.0649 0.0702 0.0667 0.0663 0.0648 0.063 + 0.0641 0.0649 0.0685 0.0668 0.0686 0.0695 0.068 +1 0.0675 0.0695 0.0737 0.0747 0.0784 0.0826 0.10 +77 0.1839 0.3124 0.4273 0.4713 0.4307 0.321 0.17 +82 0.055 -0.0061 0.0001 0.0256 0.0312 0.0308 0.0 +305 0.03 0.0274 0.03 0.0297 0.0328 0.0345 0.0365 + 0.0376 0.04 0.041 0.04 0.0429 0.0471 0.0616 +0.0889 0.1262 0.1636 0.1871 0.1837 0.1518 0.1051 + 0.0562 0.0188 -0.0013 -0.0067 -0.0044 -0.0007 -0.0 +001 -0.0015 0.0005 0.0009 -0.0005 -0.0018 -0.0007 + 0.0007 0.0016 -0.0001 0.0006 0.0015 -0.0006 -0.00 +05 -0.0008 0.0003 0.0004 0.0006 0.0004 0.0011 0. +0004 0.0004 0.0007 -0.0005 0.0002 -0.0002 -0.0007 + -0.0007 -0.0007 0.0006 0.0005 -0.0004 -0.0008

Replies are listed 'Best First'.
Re: Re: Re: foreach nightmare!
by Jaap (Curate) on May 08, 2003 at 11:18 UTC
    Untested code:
    ### Open the file if (open (FH, "file.txt")) { ### Run through each line of the file (line will be put in $_) while (<FH>) { ### Set the maximum to -1 my $max = -1; ### Run through all the numbers on this line while (m/([0-9\.\-]+)/g) { ### number is put in $1 by regexp if ($1 > $max) { $max = $1; } } print "$max\n"; } close (FH); }
    This could be a base for the program you want. I don't really get the stuff about 'derivative' so i ignored it.