$name = $user[$idx] -> {'name'}; # may create a hash
$name = $user[$idx] ?-> {'name'}; # leaves @user alone
$name = $person -> name; # chokes on undef
$name = $person ?-> name; # passes undef on
####
# If velocity is defined, use it, otherwise don't.
# Note that just the concatenation arg is guarded,
# so you still get an error if $b is not a hashref.
$a = $b->{'velocity'}^^ . ' mph' // 'unknown';
# Safe dereferencing of $d (it may be undefined).
# Note that the second dereference is normal,
# so parent() returning undef would trigger an error.
$c = $d^^ -> parent -> name;
# Safe dereferencing of $d (it may be undefined).
# Note that the second dereference is normal,
# so a nonexistent 'parent' component would be created.
$c = $d^^ ->{'parent'}->{'name'};
####
# these two are equivalent:
$a = foobar($b^^);
$a = foobar($b);
# this would be safer:
$a = defined($b)? foobar($b): undef;
####
$f = ($g | $h^^ | $i)^^ & $j;
####
# these two are equivalent:
$a = $b . $c^^;
$a = defined($c)? $b . $c: undef;
####
# these two are equivalent:
$a = foo() ?? bar();
$a = defined(foo())? bar(): undef;
####
$a = "hello $b"; # may trigger a warning
$a = "hello $b^^"; # does not help
$a = 'hello ' . $b^^; # may evaluate to undef
####
$a = $b^^++; # error
$a = $b++^^ * $c; # ok
$a = ++$b^^ * $c; # ok but pointless