in reply to no reaction on string replace

G'day semipro,

Welcome to the monastery.

Please add <code>...</code> tags around your posted code: it's very hard to read as is.

You problem is probably this line:

my $S="C:Users\name\Desktop\a.txt";

Characters prefixed with a backslash inside double-quotes have a special meaning. See perlop: Quote and Quote-like Operators and perlop: Quote-Like Operators.

You can fix this by either doubling up the backslashes:

my $S="C:Users\\name\\Desktop\\a.txt";

or simply using single-quotes instead:

my $S='C:Users\name\Desktop\a.txt';

I don't use MSWin much, but I think you have an additional problem with C:Users: should that be C:\Users?

-- Ken