I have tried the below perl script to modify the major version number in a
Unicode text file. It seems that the substitution never happens as the
'print' statement in the script below simple echoe the contents of the line.
Any ideas as to what I am doing wrong? The Unicode file looks something
like:

EngineSpecificProperties=ExeVerMajor\=0\;ExeVerMinor\=0\;ExeVerTradeMark\=

Thanks again.

Kevin Burton
[EMAIL PROTECTED]



$filename = "HelloJava.vjp";
open(FILE, $filename) or die "Can't open `$filename': $!";
my $string = "EngineSpecificProperties";
$string =~ s/(.)/$1\x00/g;      # Expand ANSI to UTF-16
while (<FILE>) {
        if(/$string/) {
           s{
               E\x00x\x00e\x00V\x00e\x00r\x00M\x00a\x00j\x00o\x00r\x00  #
ExeVerMajor
               \\\x00=\x00                                              # \=
               {                                                        #
Capture to $1
                   (?:                                                  #
Group
                    [0-9]\x00                                           #
Digit followed by \x00
                    )+                                                  #
One or more
               }                                                        #
End capturing to $1
               \\\x00;\x00                                              # \;
           }{
               my $number = $1;
               $number = tr/\x00//d;
               $number++;
               join '',
               map "$_\x00",
               split //,
               'ExeVerMajor\\=' . $number . '\\;'
           }ex;
           print;
        }
}
close FILE;

HelloJava.vjp

Reply via email to