I see, but I cant get the value for $entry->{'NAME'} unless I am inside of the WHILE and since there will be lots of files been created I need to use the value of $key to name these files. The value of $entry->{'NAME'} is one per file, it does not need to be in a loop.
Once I have all the data pushed into the @data array how it would be possible to create the files for each $entry->{'NAME'} ?