J
- J0AN -
Guest
$line = 'name varchar2(20) NOT NULL';
$find = 'varchar2\((.+)\)';
$replace = 'varchar($1)';
$line =~ s/$find/$replace/;
print $line."\n";
$line2 = 'name varchar2(20) NOT NULL';
$line2 =~ s/varchar2\((.+)\)/varchar($1)/;
print $line2."\n";
Result
c:\perl>perl test.pl
name varchar($1) NOT NULL
name varchar(20) NOT NULL
QUESTION:
When I run the Perl, the first place ($ line) is done with variables.
The second is a direct replacement.
The result of the script that would be the same, but it is not.
$find = 'varchar2\((.+)\)';
$replace = 'varchar($1)';
$line =~ s/$find/$replace/;
print $line."\n";
$line2 = 'name varchar2(20) NOT NULL';
$line2 =~ s/varchar2\((.+)\)/varchar($1)/;
print $line2."\n";
Result
c:\perl>perl test.pl
name varchar($1) NOT NULL
name varchar(20) NOT NULL
QUESTION:
When I run the Perl, the first place ($ line) is done with variables.
The second is a direct replacement.
The result of the script that would be the same, but it is not.