its look my program it was looping wrongly / twiceWhich loop? There is a huge loop within the
display subroutine, and one in the main program.
If the one in the subroutine is wrong, then look at where you change
$data:
@record = unpack $template, substr $data,0,$len,'';
Maybe check
$len?
If the loop in main, then that would indicate you are not hitting end-of-file when you expect, which implies the file has a different layout to the one you expect. Go back to the specification of the file layout and recheck your code.
Update: I just noticed you are using
Switch. This has a range of strange side effects, and should not be used - use
given/
when, or a hased based despatch table instead. I can't say that
Switch would cause your problems, but those are rather vague anyhow.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.