- or download this
my $bar = expensive();
$foo = $bar if defined $bar;
- or download this
if (defined(my $bar = expensive())) {
$foo = $bar;
}
- or download this
$foo = $_ for grep defined, expensive();
- or download this
sub assign_ifdef { $_[0] = $_[1] if defined($_[1]) }
assign_ifdef($foo, expensive());
- or download this
my $bar = expensive();
($i1, $i2) = $bar if defined $bar;
- or download this
if (defined(my $bar = expensive()) {
$_ = $bar for $i1, $i2;
}