in reply to Substituting method from object

In a substitution, the replace value isn't evaluated, it's treated as a string. If you want it to be evaluated, you need to use the /e modifier.

$error_string =~ s/error/$user->get_error_string/e;

This is also how you would replace something with the value returned by a function or any other code.

elusion : http://matt.diephouse.com