The type of return value depends on the calling syntax used, get() or hash(), and the Perl evaluation context, scalar or array, as shown in Return type for call syntax and Perl evaluation context.

Table 1. Return type for call syntax and Perl evaluation context

Expression syntax

Property type

Return type in scalar context

Return type in array context

$obj->{prop}

scalar

scalar

scalar in [0]

$obj->{prop}

array

array ref

array ref in [0]

$obj->get(“prop”)

scalar

scalar

scalar in [0]

$obj->get(“prop”)

array

array ref

array

For example, if the attribute MyValue is declared as an integer in the MODEL code, then the return type for that property will be an integer. Multiple values are always returned in an array or array reference.