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.)
Comment on
Re: storing hex data in a file
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";
[download]
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.
[reply]
[d/l]
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.
[reply]
In Section
Seekers of Perl Wisdom