in reply to variable interpolation

I have a function that has several variables called $val1, $val2, ... , $val10.

There's your problem. You want $val[1] through $val[10] instead. And maybe even $val[0].

-- Randal L. Schwartz, Perl hacker