Studio:Dealing with hex in Perl: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
(added hex in perl)
 
m (Text replace - 'Category:Perl Info' to 'Category:Studio:Perl Info')
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Hex numbers in ascript constant collection =
= 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:
[[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">
Line 9: Line 9:
</source>
</source>


For more information, see [[perldoc | http://perldoc.perl.org/functions/hex.html]]
For more information, see [http://perldoc.perl.org/functions/hex.html perldoc]




[[Category:Perl Info]]
[[Category:Studio:Perl Info]]

Latest revision as of 23:52, 20 August 2009

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