So what other uses are out there? What can be achieved with an lvalue subroutine that can't be achieved with a variable? Admittedly, TMTOWTDI...sub error :lvalue { $error_string; } error() = "This is error 1\n"; while(1) { print error(), "\n"; # Code somewhere else assigns a new value # to error() (perhaps in a callback?) # The next time error is called, it prints # a different value. }
In reply to Uses for an lvalue subroutine by bent
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |