in reply to keys and values
Please read perldata.
Contents of CSV sheet1, stored in hash table.$VAR1 = 'key_2'; $VAR2 = 'value_2'; $VAR3 = 'key_1'; $VAR4 = 'value_1';
This is not a hash table. This is a series of assignments of values to four independent variables. At most, this looks like an array broken up into pieces, which should be written as
@VAR = ('key_2', 'value_2', 'key_1', 'value_1');
In a perl hash table, values are associated to keys, and the values can be retrieved with the keys.
%VAR = ( key_1 => 'value_1', key_2 => 'value_2'); print "value for key 2: '$VAR{key_2}'\n"; __END__ value for key 2: 'value_2'
Please read perldata. Done that (and trying what's stated there) you will be able to find out how to print values corresponding to keys.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: keys and values
by Anonymous Monk on Sep 22, 2014 at 23:05 UTC |