in reply to Re: Golfing Array_Pad (54)
in thread Golfing Array_Pad
With slightly easier to read vars:
sub p{($a,$b,@_)=@_;@*=($b)x(-@_+abs$a);$a>0?(@_,@*):(@*,@_)}
Also the prototype of abs makes this annoying, i thought you could reorder the -@_+abs$a to lose one of the operators but the abs() then requires parens. Nice one by the way. :-)
|
|---|