On Thursday 15 July 2004, Declan.Grady at nuvotem.com (Declan Grady) wrote:
>I have two arrays, @openitems, and @customernames.
>I need to create a new array which will take all the openitems, and lookup
> a customer name in the @customernames array, based on the customercode,
> which is common to both arrays.
>>i.e.
>@openitems is:
>code, type, value, date, ref, ... etc
>>@customernames is:
>code, name
Arrays are lists, indexed by number. So what exactly do you have as the
contents of your arrays - comma separated strings? references to something
else (I doubt this, but . . .)? i.e. how are you storing in @openitems all of
code, type, value, date, ref, ... etc because an array has only an index, and
a value - but that value can be a string, which you can be parsing to get
those things, or a reference to a has, or . . .
>I guess its something to do with a hash, but I guess I dont fully
>understand how that works.
Hashes are like arrays, but instead of being indexed by a number, they are
indexed by a string. Probably the answer to your problem does involve the use
of hashes.
Niall
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!