Hashes are slower than arrays, but I don't usually worry about those things
unless performance is an issue.  I recommend (others will no doubt have
different opinions) that you use a hash when it makes your life easier... in
this case it might not, but that is up to you to decide.  The only time I do
things the "harder" way is if it saves a good amount of run time.

By the way, you are using an array and *not* a list.  It might seem like
they are synonymous but they really aren't.  And array is a Perl data type
and a list is just a list of data.  There was a good article in the Perl
Journal differentiating between them, it might also be on Perl.com.

Rob

-----Original Message-----
From: Scott [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 11, 2002 10:12 AM
To: [EMAIL PROTECTED]
Subject: Lists or hash


Thank you to everyone on this list who has been most helpful and patient!  
I was able to track down the Camel Book at a bookstore and I have not 
stopped reading.  I do have a question concerning list and hash and the 
performance.

I am reading a file into a list and then formatting it to prepare it for a 
mainframe.  Currently I read the contents into a list as such:

my @fields = split(/\t/, $record)
and then I call them by $fields[0], etc.

Would it be more beneficial to use a hash instead?  Or is that overkill?  
I would need to set the key and then import the values from the file 
import.

-Scott



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

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

Reply via email to