As the subject mentions, enclosed please find a little test script to give seek(FH,$offset,0) a fair workout on a small generated text file. I find that without supplying this script with an argument that all tests fail, that is, one cannot seek() within a file opened for writing. However one can give an argument and all 21 tests pass. FWIW this is the same result I obtained with perl 5.005_03 on linux-ppc, so I suppose there is no problem with seek on MacOS perl: #!./perl # # NAME # seek.t # SYNOPSIS # test seeking on open (for writing) filehandles. # USAGE: # perl seek.t # perl seek.t close_then_reopen # miniperl may be substituted for perl in the above usage. # my $data = <<'EOD'; almond beechnut chestnut doughnut elmnut firnut EOD my @data=split("\n",$data); # behavior same under MacOS miniperl 5.6.0 with either open(): #open(NUT,"+>nut-$$") or die "Could not open nut-$$: $!"; open(NUT,">nut-$$") or die "Could not open nut-$$: $!"; print NUT $data or die "Could not print data to nut-$$: $!"; if (@ARGV) { # close and re-open close NUT or die "Could not close nut-$$: $!:"; open(NUT,"<nut-$$") or die "could not open nut-$$ to read: $!"; my @read_data = (<NUT>) or die "could not read nut-$$: $!"; } print "1..",int(@data*(@data+1)/2),"\n"; my $test = 1; my $offset = 0; for (my $j = 0; $j < @data; $j++) { # The following works at least with single character endl's (MacOS, Unix, VMS): if ($j > 0) { $offset += length($data[$j-1]) + 1; } seek NUT,$offset,0; for (my $i = $j; $i < @data; $i++) { chomp(my $datum = <NUT>); print +($datum ne $data[$i]) ? "not # datum is $datum; data[$i] is $data[$i] " : '', "ok $test\n"; $test++; } } # clean up close NUT or warn "trouble closing nut-$$: $!"; unlink("nut-$$"); __END__ Peter Prymmer ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-porters-request@macperl.org