ibanix has asked for the wisdom of the Perl Monks concerning the following question:
Hello my monkish friends,
I'm trying to find a simple and efficent way to:
1) Read a line from a file
1b) Do stuff....
2) Edit that line
3) Write it back to file in the same location (overwrite)
4) Repeat for next line, etc.
I know I can open(my $fh, "+<< $file") to open my file in read/append mode. I also know that I can use seek() to jump around in the file, though my actual use of it hasn't been much.
Any advice here?
Thanks,
ibanix
$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
I'm trying to find a simple and efficent way to:
1) Read a line from a file
1b) Do stuff....
2) Edit that line
3) Write it back to file in the same location (overwrite)
4) Repeat for next line, etc.
I know I can open(my $fh, "+<< $file") to open my file in read/append mode. I also know that I can use seek() to jump around in the file, though my actual use of it hasn't been much.
Any advice here?
Thanks,
ibanix
$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
Back to
Seekers of Perl Wisdom