[Mpls-pm] Stupid peel question

Ken Williams kenahoo at gmail.com
Fri Nov 16 04:58:23 PST 2007


On Nov 14, 2007, at 2:53 PM, Chris wrote:

> Let's say I have a 500mb file, and I want to use IO:File to write data
> to the middle of the file.
>
> I used w+ mode, seeked a position, wrote my string, then seeked to the
> end of the file, but it was still truncated to the end of the last
> write.  My goal was to keep the file size constantly at 500mb.

It should work fine:

% perl -le 'print "x"x79 for 1..5' > data
% perl -le 'open $fh, "+< data"; seek $fh, 80, 0; print $fh "y"x79'
% cat data
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxx
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 
yyyyyyy
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
xxxxxxx



> Chris J
> Sent from my iPhone

Is that why it's a "peel" question and not a perl question? =)

  -Ken



More information about the Mpls-pm mailing list