J
Joan Interactive Bussiness
Very easy sample:
# line to translate
$line = 'var varchar2(10)';
# I hope to answer: var number(10)
# With replace Variable, not OK
$find = 'varchar2\((.+)\)';
$replace = 'number($1)';
$line =~ s/$find/$replace/;
print $line."\n";
# result >>>>>> var number($1)
# Without replace Variable, it's OK
$line2 = 'var varchar2(10)';
$line2 =~ s/varchar2\((.+)\)/number($1)/;
print $line2."\n";
# result >>>>>> var number(10)
# ----------------------------------------
P:\DB\WORK\perl>perl test.pl
var number($1)
var number(10)
# line to translate
$line = 'var varchar2(10)';
# I hope to answer: var number(10)
# With replace Variable, not OK
$find = 'varchar2\((.+)\)';
$replace = 'number($1)';
$line =~ s/$find/$replace/;
print $line."\n";
# result >>>>>> var number($1)
# Without replace Variable, it's OK
$line2 = 'var varchar2(10)';
$line2 =~ s/varchar2\((.+)\)/number($1)/;
print $line2."\n";
# result >>>>>> var number(10)
# ----------------------------------------
P:\DB\WORK\perl>perl test.pl
var number($1)
var number(10)