After fixing all the issues with ()/{}, the error is now with an uninitialized value in string eq at line 73 "$m++;"
but I am thinking that perhaps I need to expand the if loop that contains the arrays to include $l and $m. As for the <IN>, doesn't reading into $query allow me to access the string outside of the first while loop?