>>>>> "Daniel" == Daniel Falkenberg <[EMAIL PROTECTED]> writes:

Daniel> Because I am still new to Perl I have a few questions I would
Daniel> like to ask.  Basically throughout one of my Perl programs I
Daniel> set a whole heap of variables to a hash element such as...

Daniel> $hash_ele1 = %hash{hashele1};
Daniel> $hash_ele2 = %hash{hashele2};
Daniel> $hash_ele3 = %hash{hashele3};
Daniel> $hash_ele4 = %hash{hashele4};
Daniel> $hash_ele5 = %hash{hashele5};

Daniel> I was told once by a very experienced programmer that it is
Daniel> bad code practice to repeat unnecessary code.  Is the above an
Daniel> example of this.  If so how would I resolve a problem like
Daniel> this.

Don't make up all those separate variables!  You already have the data
in the hash.  Back up a step.  Tell us what problem you are trying to
solve, such that your solution ended up here.  This is a dead end.
(Yes, you can hack it this way, but if you're new to Perl, and perhaps
new to programming, we can help get you on the right track.)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to