in reply to Re^2: add missing elements and remove duplicates....and some more questions.
in thread add missing elements and remove duplicates....and some more questions.
One improvement you could make is to get the largest and smallest number in a single pass "for" loop.
The point that choroba was making is the subtle difference between the way "hex" representation of numbers is stored.
In your code, perl will automatically convert 0x47 into it's internal binary representation, thereby losing the "original" representation.
However, if you maintain the quoted string "0x47" as a string (which is what the "qw" operator would do), you could maintain the "original" representation.
All this is "extra" since the teacher did not mention any requirement to maintain original representation.
Also - Trying to maintain the original - will add a small amount of complexity - you will need to convert to binary, before making comparisons. The simplest way to do that is to add 0 to it.
...Disinformation is not as good as datinformation. Don't document the program; program the document.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: add missing elements and remove duplicates....and some more questions.
by pritesh_ugrankar (Monk) on Apr 23, 2017 at 17:41 UTC |