1,2,3 and 4 are not files, but hashes - if I'm not trippin'. Assuming that, you can
create arrays for each hash value (GID, AIG, etc)
read each key in a hash, push the value into the array
repat this for all of the hashes
I'm too lazy to be proud of being impatient.