in reply to Howto return a reference of an array of custom class?

 $_.p();

'.' is the concatination operator in the current version of perl. You likely wanted $_->p();