[ILUG] [OT] perl question...
Niall O Broin
niall at linux.ie
Thu Jul 15 12:35:56 IST 2004
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
More information about the ILUG
mailing list