Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: Hex String XOR

by tobyink (Abbot)
on Mar 13, 2012 at 01:19 UTC ( #959214=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Hex String XOR
in thread Hex String XOR

Yes, ^ does work on strings, but as the OP mentioned, it works on the string's bytes, not the hexadecimal numbers encoded in the string.

$ perl -E"say '112233'^'aabbcc'" PPPPPP $ perl -E"say sprintf '%x', 0x112233 ^ 0xaabbcc" bb99ff

My code gives the latter behaviour (which the OP wants) on hexadecimal strings of arbitrary length.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2016-06-25 09:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (323 votes). Check out past polls.