in reply to error in perl script while processing xml data.

Read the documentation of the modules you are using. See XML::Simple, especially the discussion of ForceArray.