# the hapless, inefficient version:
...
return &result_of_some_big_long_calculation(...args...)
if &result_of_some_big_long_calculation(...args...);
...The obvious answers are this:
my bool $x = &result_of_some_big_long_calculation(...args...);
return $x if $x;-or the identical -
my bool $x;
return $x if $x = &result_of_some_big_long_calculation(...args...);Is there a way that doesn't require the named variable? Perhaps using C<when>? Just a thought experiment on my part, reduced from some code examples that do this sort of thing in a duplicitous fashion, switch-like...
my bool $x;
return $x if $x = &calc_try_1(...);
return $x if $x = &calc_try_2(...);
return $x if $x = &calc_try_3(...);
...MikeL
