#-- set up the vars to be like what Win32::TieRegistry returns (a string and a number); my ($dword, $type) = ( '0x00500000', 4); if ( $type == 4 ) { $dword = hex $dword; } printf "Dword:\tdec:%d\thex:%x\n", $dword, $dword; my $mask = 0x00400000; printf "mask:\tdec:%d\thex:%x\n", $mask, $mask; my $flags = 0x00100000; printf "mask:\tdec:%d\thex:%x\n", $flags, $flags; my $testdw = $dword & $mask; my $newdw = $dword | $flags; printf "TestDW:\tdec:%d\thex:%x\n", $testdw, $testdw; printf "NewDW:\tdec:%d\thex:%x\n", $newdw, $newdw; #### Dword: dec:5242880 hex:500000 mask: dec:4194304 hex:400000 mask: dec:1048576 hex:100000 TestDW: dec:4194304 hex:400000 NewDW: dec:5242880 hex:500000