And this works but you shouldn't use it:# This works but is NOT recommended, and can be unsafe. my $n = eval "0xDEADBEEF"; print "$\n"; # Output: # 3735928559
It is not unsafe. "0xDEADBEEF" is a string constant. It is just as if 0xDEADBEEF had been put into the source code at the first place, with the difference that the literal is evaluated at compile time, whereas eval "0xDEADBEEF"; is evaluated at run time. Neither of them is safer than the other.
String eval is not unsafe per se - but it is unsafe if applied upon strings of dubious provenience. Every piece of perl code (which is a bunch of strings) is eval-ed by the perl binary.
In reply to Re^2: hex numbers
by shmem
in thread hex numbers
by LloydRice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |