> On Fri, 11 Jan 2002, Hanson, Robert wrote: > > 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. > > It would make my life much easier and since the > amount of records will not be in the thousands, I > guess I will go that route.
You might prefer the form: my ($first, $second, $third) = split; which is list assignment. Rarely do you really need a hash for this purpose, usually either an array or individual scalars are most appropriate. If you need to return a hash, then the following structure works nicely: my @values = split; my %hash = ( first => $value[0], second => $value[1], third => $value[2] ); Look, it even documents what each element means! Alternatively, you could try: use constant first => 0; use constant second => 1; use constant third => 2; my @values = split; print $value[third]; This last approach is more appropriate for use within packages/classes, since those constants should appear at the top of the script - preferably not far from the code that it relates to. > > > 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. > > Thank you for the correction, I will check for the > article. Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]