Instead of this --> length($rec3) I tried using this --> length($records{ $rec1 }{ $rec2 }{ $rec3 })