Low level data manipulation in Perl

G

Guest

Hi everyone,

I have spent a few hours looking on Google, Perl.com, CPAN etc to try find
some information on messing about with low leveldata in Perl. I am talking
about opening files and looking at them in their very simplest format, 1s
and 0s.

What I have noticed from my searches so far is things like pack(), unpack(),
binmode() and some other stuff, but not really what I'm looking for, AFAIK.

Actually, you're in the right direction. pack(), unpack(), ord(), chr(), vec()
and sometimes sprintf() (sprintf mostly for the "looking at" part)

I look at them kind of like a letter "1" and then there is a binary
1, (031x and ^A I believe). Unless you tell it with unpack() (or for single
byte ASCII ord()) that you're really interested in it numerically, perl will treat
the data as text.

$a = 'A';

$a + 1; # is '1'

ord($a) + 1 # Should now be 66.

Sometimes I'll add a zero to something to force numeric context:

$a += 0;

Jamie
 
B

Brian McCauley

In said:
Actually, you're in the right direction...

[snip valid comment ]

But this thread is a month dead and all that was discussed then!

This isn't the only old thread you've posted to. If you are seening
these as new posts rather than the start of exisitng (and indeed
complete) threads then there may be something wrong with your Usenet
reader (or your understanding of it).
 
G

Guest

In said:
Actually, you're in the right direction...

[snip valid comment ]
But this thread is a month dead and all that was discussed then!

Thanks!

Actually, I think it has more to do with my news server. They appeared
"new" to me for some reason. (I'm using leafnode, perhaps it didn't expire
the way I'd thought)

Anyhow, thanks for pointing that out.

Jamie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top