Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

RE: All array elements the same?

by Nitsuj (Hermit)
on Aug 01, 2000 at 21:12 UTC ( [id://25504]=note: print w/replies, xml ) Need Help??


in reply to All array elements the same?

Yes there is!

Make a scalar of size equal to the array, give it a value that is the same, do a comparison. If you take a look at the processes, this is actually a pretty quick way for many numbers :-)

This is ESPECIALLY true for numbers such as 0.

This is also true for certain types of numbers.

Think like this.


Unsinged Integer Decimal ValueBinary ValueArray of Unsigned Integers Value
1000000011
257000000010000000111
65793000000010000000100000001111
.........

Now all you have to do is a comparative operation. Much more can be extracted. By telling a range of difference, you can figure out which characters are different, like say that it is less than 256 off, you know that the first byte is different!

COOL, HUH?

"We're all different!"
"I'm not"
-The Life of Brian

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://25504]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found