Perl: the Markov chain saw | |
PerlMonks |
Re^3: Perl Hashes in C?by flexvault (Monsignor) |
on Aug 13, 2015 at 19:02 UTC ( [id://1138483]=note: print w/replies, xml ) | Need Help?? |
You are used to working with decimal numbers, but pack/unpack can be used to convert between binary, octal, decimal and hexadecimal. To use 48bit RGB, just think of the 6 octets as 3 16 bit numbers. Then this works: A lot of monks here are better at the math than I, but I can hold my own most of the time! For the future, ask specific questions that show your problem and when possible show the code that's demonstrating the problem. For your initial problem, you didn't have to worry about endianess, but you may have to consider it if your working with different architectures. Good Luck...Ed Regards...Ed "Well done is better than well said." - Benjamin Franklin
In Section
Seekers of Perl Wisdom
|
|