Raubtier
my $num_hsps = () = $tiling->hsps();
Genau das wäre auch meine Lösung.
Allerdings ist das hier nicht wirklich ein Array im Skalarkontext, auch wenn es sich ziemlich analog verhält.
Dies hier ist eine Listenzuweisung im skalaren Kontext, und die ergibt immer die Anzahl der Elemente von der Liste auf der rechten Seite.
Auszug aus perlop:
QuoteAssignment Operators
"=" is the ordinary assignment operator.
[...]
Similarly, a list assignment in list context produces the list of lvalues assigned to, and a
list assignment in scalar context returns the number of elements produced by the expression
on the right hand side of the assignment.