On Aug 5, Vinay Thombre said:

>I am novice to Perl and learning very basic things. I want to replace a text
>in a file with new text. I want to do it programatically. How can I do that?

I hope you've got a good book or two, such as "Learning Perl" (the llama
book) published by O'Reilly.

The basic setup you'll want to use is this:

  open INPUT, "< in.txt" or die "can't read in.txt: $!";
  open OUTPUT, "> out.txt" or die "can't write out.txt: $!";
  while (my $line = <INPUT>) {
    # do something to $line
    print OUTPUT $line;
  }
  close OUTPUT;
  close INPUT;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to