in reply to Unexpected Output
Instead, use
$string = $#arr == -1 ? 'True' : 'False'; [download]
If you want to assign to two different variables, use an ordinary if construct instead of the ternary operator.