Thanks, this elaborates on your analysis as
johngg mentioned. I do not have fixed record seperators but I do have records of variable length/content so I rely on offset and size. I intend to use your example based on calculating each record's end offset:
#!/usr/bin/perl -slw
use strict;
my $data = <<EOD;
record 1 is 20 bytesrecord 2 is 20 bytesrecord 3 is longer at 30 bytes
EOD
my $p = 0;
my @refs;
# endpos would be calculated based on recsize - this is simplified:
my @endpos=(20,40,70);
for (@endpos) {
push @refs, \substr $data, $p, $_ - $p;
$p = $_;
}
print '[',$$_,']' for @refs;
Hope I got that right.
Niel