
perlplexer
Deleted
Jan 3, 2001, 11:29 AM
Post #2 of 3
(299 views)
|
1) instead of converting integers to strings you can use OR and AND logic operators to set/reset bits. $a = 4; # 0000 0100 $a = $a | 0x01; # 0000 0100 OR 0000 0001 = 0000 0101 $a = $a & 0xFB; # 0000 0101 AND 1111 1011 = 0000 0001 2) This will require more memory but, hopefully, will be easier to understand @earth = ([ {}, {} ], [ {}, {} ]); $earth[0][0]{'water'} = 1; $earth[1][0]{'known'} = 1; $earth[0][1]{'water'} = 1; $earth[1][0]{'known'} = 1; $earth[1][0]{'water'} = 1; $earth[1][0]{'known'} = 1; $earth[1][1]{'unknown'} = 1; or @earth = ([ [] , [] ], [ [], [] ]); $earth[0][0][0] = 1; $earth[0][0][1] = 1; $earth[0][1][2] = 1; $earth[0][1][1] = 1; $earth[1][0][4] = 1; $earth[1][0][1] = 1; $earth[1][1][0] = 1; $earth[1][1][1] = 0; hope this helps... --perlplexer
|