$_ = join "", @SORTME, "\n\n"; while (/(AMAFILE):\s+(.*)\n(STATUS):\s+(.*)\n(DATE CREATED):\s+(.*)/g) { push @array, { $1, $2, $3, $4, $5, $6 }; }