# perldoc > Template::Plugin::Scalar

---
type: CommandReference
command: Template::Plugin::Scalar
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `[% USE scalar %]` — load the plugin
- `[% object.scalar.method %]` — call object method in scalar context
- `[% scalar.my_sub_ref %]` — call subroutine reference in scalar context

## Name

call object methods in scalar context

## Synopsis

perl
[% USE scalar %]

# TT2 calls object methods in array context by default
[% object.method %]

# force it to use scalar context
[% object.scalar.method %]

# also works with subroutine references
[% scalar.my_sub_ref %]
## Description

The Template Toolkit calls user-defined subroutines and object methods using Perl's array context by default. This plugin module provides a way for you to call subroutines and methods in scalar context.

## Examples

perl
[% USE scalar %]
[% object.scalar.method %]
[% scalar.my_sub_ref %]
## See Also

- [Template::Plugin](https://www.chedong.com/phpMan.php/perldoc/Template%3A%3APlugin/markdown)