>>>>> "nanambalasi" == nanambalasi <okidan@...> writes:
nanambalasi> I got two questions, first is there a way to add binary numbers?
nanambalasi> I mean we got two numbers
nanambalasi> 01100010 and
nanambalasi> how do we OR, XOR and ADD these binaries. Without converting it to
nanambalasi> decimal then doing & operation and then back to binary.
I don't know why you'd need to convert it to decimal. The number
format of 0b01100010 works just fine as literals. If you are reading
the data instead, pack "N", unpack "B*", $value works pretty well to
convert it into a number (NOT decimal!).
Probably what you want is:
printf "%b\n", 0b01100010 & 0b11001001;
Similarly, "|" for "or", "^" for "xor", and "+" for add.
nanambalasi> Second question, I want to measure time taken for some operation, i
nanambalasi> always used this method:
See the DateTime modules in the CPAN.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!