in reply to
while (scalar()
I cant't find the place where you pop or shift elements from your arrays, so your while-loops are infinite.
Comment on
Re: while (scalar()
In Section
Seekers of Perl Wisdom