in reply to Re^4: no reaction on string replace
in thread no reaction on string replace

You don't need the foreach loop as you have for @lines.
#!/usr/bin/perl -w use strict; my $SCU = 'C:/Users/Desktop/a.txt'; open (FILE, '<', $SCU) or die "$SCU File not found : $!"; my @lines = <FILE>; close (FILE); my @newlines; #foreach(@lines) { push @newlines, s/test/xyz/rg for @lines; #} open (FILE, '>', $SCU) or die "Could not open file $SCU: $!"; print FILE @newlines; close (FILE);
poj