Amit Saxena wrote:

Try this code fragment (have not run it though) :-

#/usr/bin/perl

use warnings;
use strict;

open (HTMLFILE, "</tmp/test.html") or die 'Can't open HTML FILE
/tmp/test.html : $!\n\n";
open (HTMLFILE1, ">/tmp/test1.html") or die 'Can't create HTML FILE
/tmp/test1.html : $!\n\n";

my $str;
while (chomp($str = <HTMLFILE>))
{

That is *NOT* the correct way to read a line in a while loop.  It should be:

while ( my $str = <HTMLFILE> )
{
         chomp;

Although you don't need the chomp() because you are not modifying the end of the line.

        $str =~ s/value=src/\/home\/usr\/test\//g;

        print HTMLFILE1 "$str\n";
}

close (HTMLFILE1);
close (HTMLFILE);


John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to