Perlを中心とした技術系の話などをつらつら

2005年01月27日

Template::Toolkit - 文字列の連結

Template::Toolkitのテンプレート内の文字列の連結は'_'(アンダースコア)を使う。忘れるのでメモ。

Template Toolkit Manual

You can concatenate strings together using the ' _ ' operator. In Perl 5, the '.' is used for string concatenation, but in Perl 6, as in the Template Toolkit, the '.' will be used as the method calling operator and ' _ ' will be used for string concatenation. Note that the operator must be specified with surrounding whitespace which, as Larry says, is construed as a feature:

[% copyright = '(C) Copyright' _ year _ ' ' _ author %]

You can, of course, achieve a similar effect with double quoted string interpolation.

[% copyright = "(C) Copyright $year $author" %]

Technorati TAGTechnorati TAG , ,

Posted by horiuchi at 2005年01月27日 17:39

Continuing the discussion...

このエントリーのトラックバックURL:
http://hori-uchi.com/mt/trackback/266

Comments

Post a comment




Remember personal info?