#!/usr/bin/perl # arbitray hash table my %vals = ("1","one","2","two","3","three"); # your code foreach $k (keys %vals) { $key = $vals{$k}; } print "\$key=$key\n"; # add something else to hash table %vals = ("1","one","2","two","3","three","4","four","5","five"); # your code foreach $k (keys %vals) { $key = $vals{$k}; } print "\$key=$key\n";