in reply to Push into Hash of Array

What values is $row->{pat_id} taking on? If it ever repeats, then $$patients{$row->{pat_id}} will be overwritten by the hashref assignment. If it never repeats, then you never push more than one element onto the ->{files} element.

Caution: Contents may have been coded under pressure.