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.