in reply to printing an array

Why don't you just try to find out what really is in your arrays?
... use Data::Dumper; ... print Dumper (\@idold); print Dumper (\@idnew);

then you know at least where to look for your problem ...
pelagic

-------------------------------------
I can resist anything but temptation.