The tilde ~ is a unary bitwise operator to negate the bits (ones complement), see
perlop.
The actual number returned is all bits set:
printf "0%08x\n",4294967295;
Gives:
0ffffffff m returns 0 on a failure to match:
printf "0%08x\n",~0;
also gives
0ffffffff.
Updated to explain more.