in reply to elegant way of handling hash?

my %replacementhash = map { $_="TEMP$_"; $_ => "contains $_"} 1..4;

Seriously, it all really depends, on how you actually get the values, i.e. on your APIs. Probably a for or a while loop are the best way to go. Hard to tell anyway, without seeing real code...