tags:

views:

11

answers:

1

I need to know if there is some way to replace any string as @ or * or ? or & without to put the "\" before it

Example

perl -pe 'next if /^#/; s/\@d\&/new_value/ if /param5/'  test

in this example need to replace the @d& with new_value
but I need to put the "\" before @ or &
can be other way without to put the "\" because I have random char that can be in the old value.

+1  A: 

perl -pe 'next if /^#/; my $regex=q/@d&/; s/$regex/new_value/ if /param5/' test

atiking