Thank you again, Douglas
>I think I get it now.
Not exactly, my fault, I wasn't clear again
> As soon as the totals hit 3 for a key,
>you want to print that line and all following lines.
As soon as the totals hit 3 for a key I need to print all lines for this
key - preceding lines ($totals = 1 and $totals = 2), that line and all
following lines
>The next
>question is, do you want to include the totals from lines that
>are not in dopo or in nostock.
No, the dopo list tells what should be done and is getting rid of the rest
of the data, the nostock list tells what can't be done because items are
out of stock and finally totals should give me all lines where for this
same $key $totals hit 3.
Like I said - it looks simple but I'm having problems finding the solution.
Have a great day, Douglas.
Greg.
>That's easy to deal with, though.
>Throw out the last loop, and change the next to last loop from
>this:
>
> > >>while (<ORD>) {
> > >> my ($dopo, $key, $stock, $value) = (split /,/)[2,3,4,6];
> > >> next unless $dopo{$dopo} and !$nostock{$stock}
> > >> $totals{$key} += $value;
> > >> # Save in memory? or open file again later?
> > >> push (@ord_array, $_)
> > >>}
>
>to this:
>while (<ORD>) {
> my ($dopo, $key, $stock, $value) = (split /,/)[2,3,4,6];
> next unless $dopo{$dopo} and !$nostock{$stock}
> $totals{$key} += $value;
> print if $totals{$key} >= 3;
>}
>
>If you want to include the totals from lines not printed due
>to the 'next unless' line, just move it after the '+=' line.
>
>Of course in the previous posts, we were assuming that the
>dopo and nostock values were the first value on the line in
>their comma delimited files.
>
>Is that what you wanted?
>Good Luck,
>Douglas Wilson
>
>---
>You are currently subscribed to perl-win32-users as: [EMAIL PROTECTED]
>To unsubscribe, forward this message to
> [EMAIL PROTECTED]
>For non-automated Mailing List support, send email to
> [EMAIL PROTECTED]
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]