"Sputnik" help  
Sputnik Help
Language Reference - Operators - Operator qww (Quick Hash)

Operator qww

The Quick Hash operator.

printr qww(cat meow dog woof);
// PRINTS
// Array
// (
//     [cat] => meow
//     [dog] => woof
// )

This function is a quick way to specify a lot of little single-quoted words. For example, qww(foo bar) is equivalent to array("foo" => "bar"). Using qww can make Sputnik scripts easier to read. You can actually use any set of delimiters, not just the parentheses.

It is faster and easier to read then doing

printr array("cat", "meow", "dog", "woof");
// PRINTS
// Array
// (
//     [cat] => meow
//     [dog] => woof
// )

It allows multiline too

printr qww(
            cat meow
            dog woof
           );
// PRINTS
// Array
// (
//     [cat] => meow
//     [dog] => woof
// )

Whitespace is ignored

Using a foreach loop

my $array = qww(
            cat meow
            dog woof
           );
foreach (my $key => my $value in $array)
{
   say "Key is $key Value is $value";
}
// PRINTS
// Array
// (
//     [cat] => meow
//     [dog] => woof
// )

To see a list of all the operators go here.


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