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

Re: Function to produce formatted ord values of a string

by rovf (Priest)
on Apr 20, 2012 at 08:08 UTC ( #966125=note: print w/replies, xml ) Need Help??


in reply to Function to produce formatted ord values of a string

I would do it like new_dump_buf_2, but would replace unpack by

split(//,$buf)
simply because I find it more readable. But it's a matter of taste. People used to unpack might find your code better readable...

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^2: Function to produce formatted ord values of a string
by brx (Pilgrim) on Apr 20, 2012 at 10:09 UTC
    Tell me if I'm wrong: I think it's dangerous to use split (character vs byte, unicode). With unpack it's less ambiguous.
      Well, given the sprintf format specification you are using, Unicode is not forseen anyway in your code, but in general: I don't see, why split should be unsafe (it operates on characters, which includes unicode characters), while unpack operates on bytes. Hence, maybe it is unpack which is dangerous, but since I don't have experience with unpack, I leave this question to more knowledgable monks...


      -- 
      Ronald Fischer <ynnor@mm.st>

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2016-09-26 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (491 votes). Check out past polls.