in reply to Using array refs to interpolate a function itno a string?
You can also use a scalar ref, but it doesn't look quite as nice: print "Listen ${\( f($x) )}, I'll call the organ bank if you don't stop"; Another nice way to get interpolation is with MJD's Interpolation module, which uses a tied hash that returns the key: print "Listen $P{ f($x) }, I'll call the organ bank if you don't stop"; The nice thing about this module is that the tied hash can do formatting on the key before returning it, like adding commas to numbers.
|
|---|