It may be a little unusual to construct hash keys that contain trailing whitespace, but putting that aside the challenge is that hash keys are immutable strings in Perl. Nevertheless, you can do what I think you're asking for like this:
$hash_sample_cds_genotype{"$_\t"}
= delete $hash_sample_cds_genotype{$_}
for grep {m/^\Q$cds/}
keys %hash_sample_cds_genotype;
This is assuming that you wish to find all keys that start with a string that looks like $cds, and then append a tab to that key name. Since hash keys are immutable, you pretty much have to remove one element and add it back in under the new key name, which is what this code will do.
|