in reply to is there a way to print only few key values from a hash

What do you mean? A few random values? Your question is very unspecific

You can print selected values with

foreach my $key (keys %hash) { print $hash{$key} if (somecondition); }