Thank you Randal. Yes, the formula looked ugly and the challenge from 'The Camel' on p.119, 120
prompted me to post for the Perl idiom to do the job. Jay's posting weaved the magic after some modifications.
Hard to believe that such a terse coding using only hashes can do the job
for the 30,000 records that had to be processed.


I'm satisfied that 'The Camel' challenge had been met.

Thanks to all Perl folks who follow the Sun.

Alfred,

Randal L. Schwartz wrote:

"Alfred" == Alfred Vahau <[EMAIL PROTECTED]> writes:



Alfred> $wcp = ($a6*4.0*6.0 + $a4*4.0*4.0 + $a3*4.0*3.0 + $a2*4.0*2.0) + Alfred> ($b6*3.0*6.0 + $b4*3.0*4.0 + $b3*3.0*3.0 + $b2*3.0*2.0) + Alfred> ($c6*2.0*6.0 + $c4*2.0*4.0 + $c3*2.0*3.0 + $c2*2.0*2.0) + Alfred> ($d6*1.0*6.0 + $d4*1.0*4.0 + $d3*1.0*3.0 + $d2*1.0*2.0);

I know this may only be a prototype for your later code, but it's a
red flag to me when a variable name has a sequential letter or a
number.  Almost always, you're going to want to do something to "all
the variables that look like $a_something_", and that means they
should have been an array or hash to start with.

Important clue: DO NOT NAME A VARIABLE WITH A NUMBER OR SEQUENTIAL LETTER.




--
Perl - "... making the easy jobs easy,
without making the hard jobs impossible."
'The Camel', 3ed



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to