- or download this
$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
- or download this
# If velocity is defined, use it, otherwise don't.
# Note that just the concatenation arg is guarded,
...
# so a nonexistent 'parent' component would be created.
$c = $d^^ ->{'parent'}->{'name'};
- or download this
# these two are equivalent:
$a = foobar($b^^);
...
# this would be safer:
$a = defined($b)? foobar($b): undef;
- or download this
$f = ($g | $h^^ | $i)^^ & $j;
- or download this
# these two are equivalent:
$a = $b . $c^^;
$a = defined($c)? $b . $c: undef;
- or download this
# these two are equivalent:
$a = foo() ?? bar();
$a = defined(foo())? bar(): undef;
- or download this
$a = "hello $b"; # may trigger a warning
$a = "hello $b^^"; # does not help
$a = 'hello ' . $b^^; # may evaluate to undef
- or download this
$a = $b^^++; # error
$a = $b++^^ * $c; # ok
$a = ++$b^^ * $c; # ok but pointless