Here is how I would do it:
my $file = "/foo/bar.txt"; open(FOO, "+< $file") or die qq[Could not open "$file": $!\n]; @slurp = <FOO>; seek(FOO, 0, 0); print FOO "I am at the very start of the file!\n"; print FOO @slurp; truncate(FOO, tell(FOO)); close(FOO);
In reply to Re: Writing in front of the file
by turnstep
in thread Writing infront of the file
by damian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |