Larry Wall wrote:
On Wed, Jan 14, 2009 at 09:55:38AM +0300, Richard Hainsworth wrote:
However, I came across one thing in solution #3 that I posted yesterday. $pair.fmt("%s %s") is nice, but it doesnt allow for any action on either value or key before printing (I wanted to print the value as a percentage), and this had to be done in a printf statement. In fact the printf statement was the longest and ugliest statement in the program.

Maybe I'm missing something, but you can always do:


This surely requires that foo and bar are defined as sub's.

Suppose I just need a single transformation of a value before outputting it? Eg., expressing .value as a percentage of $count?

Is there some way to include a one-off in the subroutine "chain"? Something like
$pair.value.{shift / 10}.fmt("%s");

Reply via email to