in reply to input data got lost in foreach loop?!

Could you tell us what the problem is?

Start by not hiding errors by reintroducing use warnings;.