I copied a program from the Learning Perl book. use strict;
chomp(my $date = `date`); @ARGV = glob "fred*.dat" or die "no files found"; $^I = ".bak"; while (<>) { s/^Author:.*/Author: Randal L. Schwartz/; s/^Phone:.*\n//; s/^Date:.*/Date: $date/; print; } I created a file called fred.dat with the text from the book Learning Perl. I called the script in the browser http://yes/cgi-bin/test/copy.cgi and it opens the MS DOS screen C:\WINDOWS\command.com and it hangs without doing anything. I have read the perlfaq5 and been on the site at www.perlfaq.com to try to see if it helps me. Help anyone please. ----- Original Message ----- From: "Sisyphus" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 11, 2002 3:07 PM Subject: Re: Newbie: Delete a line on a file > > ----- Original Message ----- > From: "Peter Eisengrein" <[EMAIL PROTECTED]> > To: "'Malcolm Debono'" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > Sent: Tuesday, February 12, 2002 8:54 AM > Subject: RE: Newbie: Delete a line on a file > > > > There are several ways this can be done. If it is a small file, and you > > really mean the last line the you could do it like this: > > > > open(FILE,$file) || die "Can't open file $file : $!\n"; > > @lines=<FILE>; > > > > pop(@lines); > > > > ### > > Now @lines has all but the last line. However, this isn't great for large > > files because @lines will be the entire file held in memory. > > > > Bear in mind that this won't actually affect the contents of the file. To do > that you would have to write @lines to a new file, delete (or rename) the > original file, and rename the new file to the original - which is the way > the perlfaq basically does it. > > Incidentally, there's some very succinct code for doing this at > http://www.perlfaq.com/cgi-bin/view?view_by_id=109 > (I haven't actually tried that. I assume it works on Windows.) > > And, Peter - Malcolm's new to perl - you should have told him to close the > file :-) > > Cheers, > Rob > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs