It is kind of a fun problem, because on the surface the student may think he/she needs to implement a whole new form of subtraction for hex numbers... rather than doing the easy thing which is to convert a hex string to a value, and then just print out the result as a hex value. I can see students learing something like operator overloading in a C++ class getting really wrapped around something like this, trying to create a whole new form of subtraction... in Perl, not nearly the same temptation and underscores the importance of referencing strings as values when you need values, and strings when you need strings.
Then again I remember in an earlier EE course, we were supposed to know how to do hexadecimal subtraction, when we were learning different number bases, longhand... which isn't that tough, especially if you can use 2's complement binary lookups.
In reply to Re^2: Perl hex substraction
by raybies
in thread Perl hex substraction
by inkubus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |