Studio:Dealing with hex in Perl: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
= Hex numbers in ascript constant collection = | = Hex numbers in ascript constant collection = | ||
[[ | [[AutoScript]] always returns constants as strings, and Perl does not convert hex strings to numeric. You can explicitly use Perl function '''hex''' to enclose the constant returned by ascript constant collection. See example below: | ||
<source lang="c"> | <source lang="c"> |
Revision as of 17:26, 20 August 2008
Hex numbers in ascript constant collection
AutoScript always returns constants as strings, and Perl does not convert hex strings to numeric. You can explicitly use Perl function hex to enclose the constant returned by ascript constant collection. See example below:
#define MY_HEX_CONST 0xFFFFFFFF
my $value = hex($main::ascript->Constants->Item("MY_HEX_CONST")->Value);
For more information, see perldoc