http://www.perlmonks.org?node_id=1225365

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I have an hash like this:
my %hash1 = ( key1 => 'relative_path', key2 => { key21 => 'another_relative_path', key22 => '/an_absolute_path', key23 => 'relative_path', }, key3 => '', key4 => 4 );
I want to create a new hash that is equal to %hash1, apart from some specific values that I want to check if these are absolute or relative paths. If they are relative paths I want to add some $home_path, For example I would want to check only these values:
$hash1{key1} $hash1{key2}{key22} $hash1{key2}{key23}
So to obtain:
my %hash2 = ( key1 => "$home_path/relative_path", key2 => { key21 => 'another_relative_path', key22 => '/an_absolute_path', key23 => "$home_path/relative_path", }, key3 => '', key4 => 4 );
It would be useful if I can define the list of values to check with some simple syntax, for example
@list = ('key1','key2:key22','key2:key23');
Thanks for any suggestion!