# This might break badly depending on $value eval "sub $AUTOLOAD { $val }"; # This will work no matter what $val happens to be. no strict 'refs'; *$AUTOLOAD = sub { $val };