in reply to Re: Variable assignment error checking
in thread Variable assignment error checking

It is arguably more readable to save off the old value, and re-instate it if func returns undef/zero:
my $oldval; $val = func( $oldval=$val) || $oldval;
Newer perl's allow the alternative of using the // (defined or) operator.

To maintain the challange of "not creating a new variable", one could try:

$val = func( $_=$val) || $_;
Add a BLOCK, if $_ is being abused:
$val = do{ func( local $_=$val) || $_ };

             When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren