Expand function calls in a string
18 May 2010
Normally when one wants to add a function call to a string variable,
the concatation operator ‘.’ is used;
my $foo = 'the time is ->'.scalar(localtime).' <- the time is';
Little known is the fact that you can expand calls directly in a string:
my $foo = "the time is -> @{[scalar(localtime)]} <- the time is";