I am trying to port a php algorithm to perl, but I am struggling with a single bit operator that I don't know ...
so php code looks like this:
...
$var = '348492634';
print ~$var;
...
result: -348492635
does the same in perl:
...
$var = '348492634';
print ~$var;
...
Result: 18446744073361058981
I read a lot about integer size depending on the processor architecture, but I never found a working solution. Maybe I'm just using the wrong function in perl ...
It is necessary for the logic to get the same result as in the php script.
Thank you in advance
source
share