Studio:Dealing with hex in Perl

From STRIDE Wiki
Revision as of 18:24, 14 May 2008 by Shamr (talk | contribs) (added hex in perl)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hex numbers in ascript constant collection

Ascript 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 http://perldoc.perl.org/functions/hex.html