"Sputnik" help  
Sputnik Help
Language Reference - Operators - Operator qws (Quick Int16 Array)

Operator qws

The Quick Int16 Array operator.

printr qws"H\x1122ello";
// PRINTS
// Array
// (
//     [0] => 72
//     [1] => 4654
//     [2] => 108
//     [3] => 108
//     [4] => 111
// )

This is useful for defining an array of 16-bit integers in string format. It can be used to represent a sequence of numbers which may not fit into a regular string format.

Using a foreach loop

my $array = qws"H\x1122ello";
foreach (my $v in $array)
{
   say sprintf("Value dec %1^d hex 0x%1^X", $v);
}
// PRINTS
// Value dec 72 hex 0x48
// Value dec 4654 hex 0x122E
// Value dec 108 hex 0x6C
// Value dec 108 hex 0x6C
// Value dec 111 hex 0x6F

To see a list of all the operators go here.


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org