[EMAIL PROTECTED] wrote: >
Hey, I hope someone can help me in calculating this:
I can try. But your problem is poorly stated and I suspect you're mixing in parts of an imagined solution as well. It's best to describe the problem as cleanly as possible, as any prescriptions about the form of the solution can exclude a better option. Lets take a look.
My goal is to pass an array, @arr1 = ("A", "C") to a subroutine
Reading ahead, it looks like these are the names of variables that you want to establish the values of.
and using another array, @arr2 = ("B.aID = A.ID", "D.ID = A.dID", "C.ID = B.cID", "E.cID = C.ID")
>
use that to then simplify @arr2 to get @arr3 = ("B = A", "D = A", "C = B", "E = C"),
I think what you mean is a simple text edit: my @arr3 = @arr2; s/\.\S+// foreach @arr3; but perhaps there is more to it than that?
and then find any related elements in @arr3 to get @arr4 = ("A = B = C", "B = C = E", "D = A = B"),
Now here I'm lost. What determines this new list of equations? From @arr3 it is clear that "A = B = C = D = E", so what is special about the three triplets you have shown?
------- ie, find what A equals, A = B A = D find what C equals, C = B C = E
As I said above, A and C are the values in @arr1. But why haven't we got A = B A = C A = D A = E because all of these are true.
find any similarities, both contain B, so, return A, B, C
And what is a 'similarity'? If all of the five variables are equal why are they not all similar?
------- I apologize ahead for any confusions/headaches, if you can help me, that would be great!
It really looks like if you can state the problem more clearly you are most of the way to a solution. Perl cannot help you to find a solution, only to implement it. I hope this helps a little. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/