I can see clearly what the problem with my unpack template is now. Its not unpack at all that's giving me the trouble, its just that I don't fully understand what to expect from a binary file! As you pointed out I only have one element in my template, but how many should I have? I can't just guess a number I want and force the result back, or can I?

I've done some experimenting with unpack to try and obtain the same results I got from opening the file in a hex editor (UltraEdit). The file contents (accodring to the editor) should be something like this:
47 49 46 38 39 61 0f 00 10 00 a2 ff 00 84 86 84 df e0 df c6 c7 c6 c0 c0 c0 00 00 00 00 00 00 00 00 00 00 00 00 21 f9 04 01 00 00 03 00 2c 00 00 00 00 0f 00 10 00 40 03 40 48 ba ac f3 60 80 49 a9 88 24 ca 0a ae 78 d9 b3 75 a4 16 4a 92 47 0e 01 6a 8d de 10 72 1c 48 df c0 29 ee 52 8b 0a c0 e0 67 17 12 1a 81 32 cd 67 29 b4 ed 8c c4 c8 91 97 a4 5a 09 b2 86 56 91 00 00 3b
and my script is giving me this output with a "H1024" template (line breaks I inserted myself just for the sake of comparing them both at the 16th position):
4749463839610f001000a2ff00848684\n dfe0dfc6c7c6c0c0c000000000000000\n 000000000021f90401000003002c0000\n 00000f00100040034048baacf3608049\n a98824ca0a ae78d9b375a4164a92470e016a8dde10\n 721c48dfc029ee528b0a c0e0671712
My unpack result seems to be munching the last line, insert line breaks in odd places, all of which I don't quite grasp... and by the way, you can find the image I'm using as an example here. I have tried using the 1st block of hexes with pack to see if I could get an image output, but that didn't help much either. So I have reached a dead end with the unpack method so far, and I refuse to beleive that this cannot be acheived with perl. Newly revised questions:Thank you again for your patience, attention, and coping with my stuborness!

In reply to Why, what, where to unpack?! (was: Files, unpack and text values) by BBQ
in thread Files, unpack and text values by BBQ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.