in reply to hashes ?

Hmmm, the code suggests your keys and values are coming from arrays @thermos, @enthalpy and @entropy, but you text speaks of scalars.

I'll assume you have arrays. What you could do is:

my %hash = map {$thermos [$_] => [$enthalphy [$_] => $entrypy [$_] +]} 0 .. $#thermos;

Abigail

Replies are listed 'Best First'.
Re: Re: hashes ?
by Anonymous Monk on Feb 26, 2003 at 11:56 UTC
    thanks Abigail-II, using your code, how could I access the key-value pairs?? e.g. the enthalpy and entropy value for each thermos key. cheers.
      $hash {$thermos [3]} [0]; # enthalpy for fourth thermos value $hash {$thermos [7]} [1]; # entropy for eigth thermos value.

      Abigail

        thanks again, but I don't really understand what context I can use this in  $hash {$thermos[3]}[0];! If i try to print it - nothing happens. If a print it within quotes, it thinks $hash is seperate to %hash and complains! How can I write a test; e.g. if $thermos[3] is equal to $some_value print the corresponding values $enthalpy and $entropy to $thermos[3]. thanks for your patience