Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$data =~ s/([^\n]) (\n) ([^\n]) /$1$3/g; # data contains the input f +ile $data =~ s/\n+/\n/g; my @data = split /\n/, $data; my $in_derivative = 0; my $info; my $element; my @numbers; foreach my $line (@data) { if ($line =~ m/^\S{4}(\s+)Derivative(.*)/) { $in_derivative = 1; } if ($in_derivative) { $info .= "$line\n"; } } my @derivative = split (/\n/, $info); my $highest; my $i; foreach my $well (@derivative) { if ($well =~ s/^\S{4}(\s+)Derivative(.*)//) { next; } $well =~ s/^(\d+){1,2}//; my $well_no = $1; my @well = split ('', $well); $highest = $well[0]; # definately problems here, cant pick out $ +well[0] for ($i = 0; $i < @well; $i++) { if ($well[$i] > $highest) { $highest = $numbers[$i]; } } print $highest; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: foreach nightmare!
by Skeeve (Parson) on May 08, 2003 at 11:30 UTC | |
by chip (Curate) on May 08, 2003 at 16:14 UTC | |
|
Re: foreach nightmare!
by Jaap (Curate) on May 08, 2003 at 10:42 UTC | |
by Anonymous Monk on May 08, 2003 at 10:48 UTC | |
by Jaap (Curate) on May 08, 2003 at 11:18 UTC | |
|
Re: foreach nightmare!
by perlguy (Deacon) on May 08, 2003 at 16:22 UTC |