Tie to change line in file

J

Jonathan Weekes

Being utterly a non Perl IT guy, I have to write a Perl script for a
web site to edit a line in a file. I have looked on Google and found
Tie to be what I needed, but I am really lost in how to change the
line. Can someone please edit the script below for me to show me how
to do this? I have already looked in the documentation and still got
lost...

use CGI qw/:standard/;
use CGI::Cookie;
use Tie::File;
print header;

%cookies = fetch CGI::Cookie;

tie @array, 'Tie::File',
"e:/inetpub/scripts/inventory.txt" or die "Could not Tie in.txt: $!";

for (@array) {
print $_;
last;
}

untie @array; # all finished


Thanks in advance,

Jonathan Weekes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top