in reply to Re: Variable assignment error checking
in thread Variable assignment error checking
Newer perl's allow the alternative of using the // (defined or) operator.my $oldval; $val = func( $oldval=$val) || $oldval;
To maintain the challange of "not creating a new variable", one could try:
Add a BLOCK, if $_ is being abused:$val = func( $_=$val) || $_;
$val = do{ func( local $_=$val) || $_ };
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
|
|---|