in reply to using Set::Scalar

Set::Scalar manages an unordered collection of values; it doesn't have anything corresponding to keys.

The simplest answer to what you seem to want would be a hash of arrays:

my %data; # create a key num_row with two values @{$data{num_row}} = ( '12350', 'archive' ); # add another value push @{$data{num_row}}, '613'; foreach my $key (keys %data) { print "Examining key $key\n"; foreach my $val (@{$data{$key}}) { print "value: $val\n"; } } print "num_row's 2nd value is $data{num_row}[1]\n";