Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: storing hex data in a file

by b4e (Sexton)
on Aug 11, 2004 at 11:34 UTC ( [id://381941]=note: print w/replies, xml ) Need Help??


in reply to storing hex data in a file

thanks for your replies, but that's not quite what i wanted...

your code stores "Ox55" in the file, ie. the hex value 30 78 35 35.

what i need is to store the hex value (eg. 55, which would be 'U' in char.)

Replies are listed 'Best First'.
Re^2: storing hex data in a file
by modred (Pilgrim) on Aug 11, 2004 at 11:57 UTC
    You probably want to take a look at pack then.
    my $x = pack("C", 0x55); print $x, "\n";
    works for you specific case but I don't have a good grasp of your general case to know if it will work for that.
Re^2: storing hex data in a file
by ikegami (Patriarch) on Aug 11, 2004 at 14:46 UTC
    Don't forget to use binmode() on your file handle if you're going to print out arbitrary values.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found