learn_perl_se has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl $fileName = "abc"; open(IN, "<", "$fileName") or die "Could not open file $fileName"; open(OUT, ">", "$fileName") or die "Could not open file $fileName"; while ($line =(<IN>)) { $new=$line; $new =~ s/foo/bar/g; } print OUT if $new =~ s/foo/bar/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Write to filehandle without deleting current text
by Corion (Patriarch) on Oct 05, 2010 at 08:58 UTC | |
|
Re: Write to filehandle without deleting current text
by Marshall (Canon) on Oct 05, 2010 at 09:15 UTC | |
by learn_perl_se (Initiate) on Oct 05, 2010 at 09:41 UTC | |
|
Re: Write to filehandle without deleting current text
by suhailck (Friar) on Oct 05, 2010 at 09:01 UTC | |
|
Re: Write to filehandle without deleting current text
by ikegami (Patriarch) on Oct 05, 2010 at 16:18 UTC | |
|
Re: Write to filehandle without deleting current text
by jc (Acolyte) on Oct 05, 2010 at 09:36 UTC | |
|
Re: Write to filehandle without deleting current text
by Proclus (Beadle) on Oct 05, 2010 at 10:57 UTC | |
by k_manimuthu (Monk) on Oct 05, 2010 at 12:48 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |