davido has the answer. That's the way to do it. If func returns 0 or undef, $var will be assigned to $var, therefore keeping its original value. I use this technique all the time.
In reply to Re^2: Variable assignment error checking
by greengaroo
in thread Variable assignment error checking
by nathaniels
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |