I don't know if it's your only problem, but you need to change push (@output, { 'row' => \@columns }); to push (@output, { 'day' => \@columns }); at least. The format you need to be returning from your sub is as follows:
return [
{
day => [
{ day => '' }, { day => '' }, { day => 1 },
{ day => 2 }, { day => 3 }, { day => 4 }, { day => 5 }
]
},
{
day => [
{ day => 6 }, { day => 7 }, { day => 8 },
{ day => 9 }, { day => 10 }, { day => 11 }, { day => 12 }
]
}
];
Update: After reverse engineering the data structure you're outputting from your subroutine, I do believe that is the only change you need to make (the one s/'row'/'day'/). It should then be fine as long as the match involved with your row/columing is correct.