简体   繁体   中英

Windows take divide operator '/' as backslash '\' in Perl command

I am working with spec benchmarks and using specperl for perl command on windows. I need to do the divide operation in perl command but windows always change / operator to \\ . So it cannot be recognized by perl.

I tried multiple writings, but / turned to \\ , // turned to \\\\ , \\/ turned to \\\\ , of course \\\\ turned to \\\\ .

Here is my specperl command:

specperl -e "system sprintf qq{start /b /wait /node %x /affinity %x%s %s}, (int($SPECCOPYNUM/40)), (1<<($SPECCOPYNUM%4)), ('0'x($SPECCOPYNUM%40>>2)), q{ %{ENV_PIN_CMD} $command } "

Just focus on int($SPECCOPYNUM/40) , if I use int($SPECCOPYNUM*0.025) , everything works fine. However, this 40 is a variable so I cannot use multiplication to replace it.

Is there no way to do / divide operation under this situation?

Any help would be appreciated.

Update

It is true that this has nothing to do with windows-perl. I tried R:/ics/itools/efi2_win64/perl/bin/perl.exe -e "system sprintf qq{start /b /wait /node %x /affinity %x%s %s}, (int(1/40)), (1<<(1%4)), '', q{ ls } " directly in windows command shell and it works fine.
When I put this in spec config file, it is changed, / becomes \\ , but I found the option /b /wait /node keeps the / . Sad. I have no idea what to do next.

Everything you say doesn't add up. There's no difference between the earlier / and the latter / as they are all in the same argument. I suspect you misdiagnosed the problem.

There's nothing in the docs about any of this.

But if there's indeed a problem with / , you can work around it as follows:

int(eval(qq{$SPECCOPYNUM\x2F40}))     # int($SPECCOPYNUM/40)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM