They wanted you to write a program that reads a file and displays the content in the shown format. The general format quite common and useful for inspecting non-text files.

Each row represents 16 bytes of the file.
The 1st column is the offset within the file, in hex.
The 2nd, 3rd, 4th and 5th column each represent 4 bytes of the file, in hex.
The last column is the ASCII representation of the same 16 bytes. Nonprintable characters are shown as ..

Update: A solution:

00000000: 75736520 73747269 63743B0D 0A757365 use strict;..use 00000010: 20776172 6E696E67 733B0D0A 0D0A6C6F warnings;....lo 00000020: 63616C20 242F203D 205C3136 3B0D0A62 cal $/ = \16;..b 00000030: 696E6D6F 64652853 5444494E 293B0D0A inmode(STDIN);.. 00000040: 0D0A6D79 20246F66 66736574 203D2030 ..my $offset = 0 00000050: 3B0D0A0D 0A776869 6C652028 3C535444 ;....while (<STD 00000060: 494E3E29 207B0D0A 2020206D 79202462 IN>) {.. my $b 00000070: 79746573 203D2024 5F3B0D0A 20202024 ytes = $_;.. $ 00000080: 62797465 73203D7E 20732F28 2E292F73 bytes =~ s/(.)/s 00000090: 7072696E 74662827 25303258 272C206F printf('%02X', o 000000A0: 72642824 3129292F 7365673B 0D0A2020 rd($1))/seg;.. 000000B0: 20246279 74657320 3D206A6F 696E2027 $bytes = join ' 000000C0: 20272C20 6D617020 2F2E7B31 2C387D2F ', map /.{1,8}/ 000000D0: 672C2024 62797465 733B0D0A 0D0A2020 g, $bytes;.... 000000E0: 206D7920 24636861 7273203D 20245F3B my $chars = $_; 000000F0: 0D0A2020 20246368 61727320 3D7E2073 .. $chars =~ s 00000100: 2F5B5E5B 3A707269 6E743A5D 5D2F2E2F /[^[:print:]]/./ 00000110: 673B0D0A 0D0A2020 20707269 6E746628 g;.... printf( 00000120: 22253038 583A2025 2D333573 2025735C "%08X: %-35s %s\ 00000130: 6E222C20 246F6666 7365742C 20246279 n", $offset, $by 00000140: 7465732C 20246368 61727329 3B0D0A0D tes, $chars);... 00000150: 0A202020 246F6666 73657420 2B3D2031 . $offset += 1 00000160: 363B0D0A 7D0D0A 6;..}..

In reply to Re: What is this question asking? by ikegami
in thread What is this question asking? by Herkum

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.