> a bit of explanation may be in order as to what I'm
> attempting here -
> what i'm trying to do is something like this. i have a
> file that has data in this form
> x1  y1
> x2  y2
> x3  y3
> x4  y4
> x1  y1
> x1  y5
>
> the requirement is to find a pair that is different
> that is find if x1 has any value other than y1 (just
> one way). the other complication is that the total
> number such pairs is about 150,000.

I might be going OT, but if the above is the REAL problem (and not reading
writing to a file), I'd suggest placing the pairs in a hash. Using
something like:

if ($HASH{"$x:$y"} = undef) {
        # Then the pair $x $y is unique, so far.
        ++$HASH{"$x:$y"};
        } else {
        # The pair is not uniq so:
        ++$HASH{"$x:$y"};
        # will contain the number of occurrences...
        }
}

But then again I might have missed the pint totally...

And, yes, the above code is untested - it's the prinicipal I want to
share...

NixGuru



_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to