On Fri, Mar 27, 2009 at 11:20:27AM +0000, Dermot wrote: > Hi All, <snip> > $bits |= 1<< ($countryid - $currentno); ### > What > is this left shift doing? Is that a or complement? > } > else > { > $bits &= 15- (1<< ($countryid - $currentno)); ### ditto > }
When trying to understand someone elses code I find little tests like this helpful, perhaps you will too. perl -le '$bits=0xffff; for $i ( 0 .. 15 ) { printf "%016b\n", $bits &= 0xffff - 1<< $i; }' and perl -le '$bits=0; for $i ( 0 .. 15 ) { printf "%016b\n", $bits |= 1<< $i; }' -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/