#!/usr/bin/perl sub top_html { return "<html><head>$_[0]</head><body>"; } print <<EOF; @{[top_html("catchy title")]} blah.. EOF
Explanation:
@{ somearef } takes an array reference "somearef" and dereferences it.
[ somearray ] takes a list "somelist"
and makes an array ref of it.
@{ [ function() ] } takes the
list returned by "function()" and wraps it in
a way that is interpolatable by quotemarks.
In reply to Re: call sub in string
by kwoff
in thread call sub in string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |