|
|
|
|
|
by pyre
5083 days ago
|
|
Depends on what you're doing. In a small string, there isn't much difference. It's more useful when doing other things: my $message = <<"HEREDOC";
Greetings @{[ get_planet() ]}lings,
We come in peace.
Sincerely,
Your New @{[ get_invaders() ]} Overlords
HEREDOC
Sure you can jam them into variables first, or use sprintf, but it's a matter of preference so long as you know what you're doing. |
|
However my point still stands. You need to be aware that it does not simply interpolate the function output in, it also switches you from scalar to list context. (IMO context is the worst idea in Perl, but it is here to stay so you need to know about it.)