Clovertech
› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › TCL compare 2 lists for any matches?
Can anyone point me in the right direction. I am looking to see if any element in LISTA matches ANY element in LISTB. How would this be accomplished? Thanks!
Mike,
Take a look at the ‘intersect’ or ‘intersect3’ commands.
Thanks,
Jim Cobane
Henry Ford Health
Ok, here is what I came up with. As long as something in the lists matches I pass the message. Is there a more efficient way to do this?
set LISTA { 1 2 3}
set LISTB { 3 4 5}
set MATCHES [intersect $LISTA $LISTB]
if {([llength $MATCHES]) > 0}
continue
else
kill
Thanks for all the help.