in reply to Not very perlish?
One post - replies to several good brethren and sisthren.
>Re: Not very Perlish? (note the capital P ;) - Noted!
>If it works, it's Perl. - True - but I wish to extend my knowledge
> you're throwing down the gauntlet for Perl Golf. - Que? "Perl Golf"?
my @items = map {$_ % 100 } @_; my $sum = 100; $sum -= $_ for @items[0..2]; $items[ $sum<0?0:2 ] += $sum unless $sum == 0;
Neat! i *think* I understand this.
Brother Frankus. - Thankyou.
Here's a Perl program that takes N numbers and scales them such that their sum becomes 100, but their ratios remain the same.
- Probably what I was unconciously seeking.
Abigail - Thankyou. This is what I will be using!
~Particle *accelerates* - I need to sanitise all inputs and continue to run. - probably an easy mod IF I understood how yours worked :)
Not sure why we're doing a modulo 100 operation here unless it's a substitution for the int() operator.
Seemed like the easy way to
a) force values <100
b) deal with non-integer inputs?
--t. alex - Thankyou.
> I think you have an excellent start - Is this "faint praise" ? :)
>. You can simplify it a fair bit, however: - And in a couple of (now you pointed them out!) very obvious ways.
- tye (but my friends call me "Tye") - Thanyou! (May I call you Tye?:)
When is P the compliment of ch?
When they are in the company of Erlish!
|
|---|