Daily Shaarli

All links of one day in a single page.

Previous day

December 31, 2020

Next day

Interpolating Functions and Expressions Within Strings - Perl Cookbook [Book]
thumbnail

Interpolating Functions and Expressions Within Strings Problem You want a function call or expression to expand within a string. This lets you construct more complex templates than with simple scalar … - Selection from Perl Cookbook [Book]

Or you can use the slightly sneaky @{[ LIST EXPR ]} or ${ (SCALAR EXPR ) } expansions:

$answer = "STRING @{[ LIST EXPR ]} MORE STRING";
$answer = "STRING ${\( SCALAR EXPR )} MORE STRING";