{ open(my $fh, '<:raw', $datfilename) or die $!; read_uint32($fh); while (!eof($fh)) { my $profile_id = read_uint32($fh); my @seqs; while (length( my $seq = read_pstring($fh) )) { push @seqs, $seq; } ... } }