How can you compare $ ^ E with a number?

In https://stackoverflow.com/a/3126168/2128, the answer assumes that (after open ) $^E can be compared to 0x20 to determine if the file is being used by another process:

 open ($fh, "<", "the-file"); if ($^E == 0x20) { ... } 

I tried this and it works. However, if I print the value of $^E , I get the line ( The process cannot access the file because it is being used by another process ).

How is a comparison with a number possible?

This is on Windows.

+6
source share
1 answer
 >perl -E"open my $fh, '<', 'nonexistent'; say 0+$^E; say ''.$^E;" 2 The system cannot find the file specified 

Like $! , $^E is a double, scalar that contains two values. One line and one number.

 >perl -E"say $^E = 0x20;" The process cannot access the file because it is being used by another process 
+9
source

Source: https://habr.com/ru/post/972245/


All Articles