http://qs1969.pair.com?node_id=87765


in reply to Re: (Golf) Giving Change
in thread (Golf) Giving Change

Nice solution. There is room for improvement, though. No need for return, use that for filtering out empty items:
sub c {($a,$c)=@_;@c=@$c;grep$_,map{$a>$_? &{sub{$a-=$_*($b=int($a/$_));"$b x $_"}}:""} reverse @c}
Char-neutral, but leaving the grep out gains 7 chars.

You don't need the parens after the int, and leave out the spaces around the reverse. Gains you 4 char:

sub c{($a,$c)=@_;@c=@$c;grep$_,map{$a>$_? &{sub{$a-=$_*($b=int$a/$_);"$b x $_"}}:""}reverse@c}

Jeroen
"We are not alone"(FZ)