in reply to Critique yet another List-to-Range function
return wantarray ? ( $end_points[ 0 ] ) : $end_points[ 0 ];A list is made by context, whether or not there are parentheses. Parentheses just provide precedence, as in print join('|', @cols), "\n". Either of these will work just as well, whichever context the function is called in:
return $end_points[0]; return ( $end_points[0] );
[There are a couple odd exceptions, such as the left hand side of the x operator. ($var x 3 returns a string, while ($x) x 3 returns a list.) But in general, parentheses are unnecessary around a list except for precedence.]
|
|---|