in reply to foreach loop with nested

Why are you using the /gmsi modifiers? Do you know what any of them do? I can't be sure from your code, but I think you can remove the /g and the /m safely.

_____________________________________________________
Jeff japhy Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;