in reply to Interpolation via return ..END...
Here is one way to do it
See also Effective Perl Programming item 58, where it is described as U.B.E.: Ugly But Effective.#!perl -w use strict; use Number::Format; sub HTML_SomethingBetter { my $t = shift; my $d = new Number::Format (-thousands_sep => ',', -decimal_point =>' +.', -decimal_fill => 2); return <<END; <tr/td code> @{[$d->format_number($t->{key})]} </tr> END } print "<-- SomethingBetter -->\n"; print HTML_SomethingBetter { key => ' 3.1415956 ' }; __END__ <-- SomethingBetter --> <tr/td code> 3.14 </tr>
My mnemonic for @{[...]} is "All Embracing Bracketts"
Cheers
Rudif
|
|---|