Your skill will accomplishwhat the force of many cannot PerlMonks

### Re^6: why are hex values not numbers?

by perl-diddler (Chaplain)
 on Sep 27, 2016 at 12:10 UTC ( #1172751=note: print w/replies, xml ) Need Help??

in reply to Re^5: why are hex values not numbers?
in thread why are hex values not numbers?

A string containing just decimal digits, can only be a number.
You could just as easily say a string containing just octal, or binary or hexadecimal digits, can only be a number.

A decimal number might be a "leetspeak" word if you were wanting to be cryptic.

Perl determines from *context* if the user is trying to use a variable as a number or a string. If the user tries to perform addition on a string -- it tries to see if the string looks like a number and allows it if it does. But there is no reason it needs to be limited to decimal digits. This is even more evident if you consider octal digits as an example. Using a rule of 'leading 0' for octal or 'leading 0x' for hex seem fairly safe -- can you give an example where doing so would be a problem?

Come-on BuK, question the status quo! ;-)

Replies are listed 'Best First'.
Re^7: why are hex values not numbers?
by hippo (Bishop) on Sep 27, 2016 at 12:21 UTC
You could just as easily say a string containing just octal, or binary or hexadecimal digits, can only be a number.

Except that you would be completely wrong.

• ABBA
• Da
• face
• Abe
• EFF

... and many, many more are clearly not only numbers.

I did specify that it would have to start with 0x to be a hex constant, and 0 to be an octal, so are you saying that 0xABBA, 0xDA, 0xface, 0xAbe, 0xEFF would all, clearly, not be hex values?

I'm sorry, but at lets at least try to stay on the same page, and forgive me if I wrote this non-linearly, but such is the PM-medium.

clearly, not be

I didn't say "clearly, not be", I said: "might not be".

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
Re^7: why are hex values not numbers?
by BrowserUk (Patriarch) on Sep 27, 2016 at 12:33 UTC
Come-on BuK, question the status quo!

I do all the time. Unlike you, I don't just ignore the answers.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
BuK:...re: question the status quo
I do all the time. Unlike you, I don't just ignore the answers.
"In the absence of evidence, opinion is indistinguishable from prejudice."

Note, quoting from circularly obtained or derived sources is not 'evidence'.

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1172751]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2023-02-07 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?