in reply to Populating an Array of Referenced Values
Perhaps you are looking for an over-complicated data structure. But please ignore this if it's not applicable. What I would do with the data you have shown us is create a simple hash, with the keys equivalent to your 'description' and the values, er.. equivalent to your 'value's:
use warnings; use strict; my @fields = ( 'temperature in Celsius', 'relative humidity in %', 'pressure in millibars %', 'dewpoint in degrees Celsius', 'total column ozone in Dobson Units', ); my @values = qw ( 23 56 1008.1 4 344 ); my %hash; @hash{@fields} = @values; # Print the whole thing: print "$_: $hash{$_}\n" for keys %hash; # Print one element: print $hash{'temperature in Celsius'};
But perhaps you have a reason for making it more complicated?
dave
|
|---|