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:my %hash1 = ( key1 => 'relative_path', key2 => { key21 => 'another_relative_path', key22 => '/an_absolute_path', key23 => 'relative_path', }, key3 => '', key4 => 4 );
So to obtain:$hash1{key1} $hash1{key2}{key22} $hash1{key2}{key23}
It would be useful if I can define the list of values to check with some simple syntax, for examplemy %hash2 = ( key1 => "$home_path/relative_path", key2 => { key21 => 'another_relative_path', key22 => '/an_absolute_path', key23 => "$home_path/relative_path", }, key3 => '', key4 => 4 );
Thanks for any suggestion!@list = ('key1','key2:key22','key2:key23');
In reply to Copy an hash modifying some selected values by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |