Home > Archive > PERL Beginners > October 2006 > Perl Unpack Function
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Perl Unpack Function
|
|
| banker123 2006-10-30, 7:03 pm |
| Correct me if I am worng, more importantly please provide help!
I have read so much on this tpoic in the last few hours I think I am
back to where I started.
I have a binary ascii representation of the letter b, which is equal to
01100010.
What I have tried:
$name=01100010;
print unpack 'A', "$name";
However this did not return the letter b as I expected? I also have a
binary file that contains several lines of text and numbers I would
like to build from the previous concept to be able to read the file in
an ascii format.
| |
| banker123 2006-10-30, 7:03 pm |
| To add I ultimatley need to be able to read in a binary index file
lookup the image offset and find the image in a binary conctanated tiff
file.
banker123 wrote:
> Correct me if I am worng, more importantly please provide help!
> I have read so much on this tpoic in the last few hours I think I am
> back to where I started.
>
> I have a binary ascii representation of the letter b, which is equal to
> 01100010.
>
> What I have tried:
> $name=01100010;
> print unpack 'A', "$name";
>
> However this did not return the letter b as I expected? I also have a
> binary file that contains several lines of text and numbers I would
> like to build from the previous concept to be able to read the file in
> an ascii format.
| |
| DJ Stunks 2006-10-30, 7:03 pm |
| banker123 wrote:
> Correct me if I am worng, more importantly please provide help!
> I have read so much on this tpoic in the last few hours I think I am
> back to where I started.
>
> I have a binary ascii representation of the letter b, which is equal to
> 01100010.
>
> What I have tried:
> $name=01100010;
> print unpack 'A', "$name";
>
> However this did not return the letter b as I expected? I also have a
> binary file that contains several lines of text and numbers I would
> like to build from the previous concept to be able to read the file in
> an ascii format.
you want to pack(), not un...
C:\>perl -e "print pack 'B*','01100010'"
b
HTH,
-jp
|
|
|
|
|