in reply to Uninitialized Value

$ perl -lwe'$x[2]="x";print @x' Use of uninitialized value at -e line 1. Use of uninitialized value at -e line 1. x $
Like kwoff and mortis said, one of your patterns isn't matching before /$ID/, so there's a hole in your data.  Notice, that if one message matched it's value would remain for all those after.  You should probably put the    @data = ('','','','','');   inside the loop.

  p