my $template = 'iifff'; my $rec_size = template_len($template); while (1) { my $rv = read($fh, my $rec, $rec_size); die "$!\n" if !defined($rv); last if !$rv; die "Premature EOF\n" if $rv < $rec_size; my @fields = unpack($template, $rec); ... }
In reply to Re^2: Iteratively unpack structure from binary file
by ikegami
in thread Iteratively unpack structure from binary file
by cMonkE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |