- or download this
$scalar = (5,10,15,20);
print $scalar, "\n";
- or download this
sub get_list
{
# return a list if a list is wanted, else
# return the string
return wantarray ? (5,10,15,20) : "SCALAR CALL";
}
- or download this
$scalar = get_list();
print $scalar, "\n";
@array = get_list();
print join(" ", @array), "\n";
- or download this
print scalar(get_list()), "\n";
print join(" ", get_list()), "\n";