my ( $value, $type ) = $key->GetValue( "$_" ); # ---- format the value as text if ( $type == 4 ) # reg_dword { $value = hex( $value ) } #### $dword = pack ( $value ); # eg $value = 5242880 dec $mask = pack ( 4194304 ); # 0x00400000 $flags = pack ( 1048576 ); # 0x00100000 $testdw = $dword & $mask; $newdw = $dword | $flags; $newval = hex ( $newdw ); # gets written to file