官术网_书友最值得收藏!

  • Perl 6 Deep Dive
  • Andrew Shitov
  • 110字
  • 2021-07-03 00:05:56

Assignment operators

The = operator is an assignment operator. It is used to assign the value of its right-hand side operand to the variable on the left. In the simplest case, the operator is used like this:

my $a;
$a = 42;

The action is not limited to scalars only. Arrays, hashes, or instances of classes (we will talk about classes in Chapter 8Object-Oriented Programming) work are also processed as expected.

my @a = <10 20 30>;
my @b = @a;

Here, the assignment operator is used twice, first to initialize the @a array, and then to assign its values to the second array, @b.

主站蜘蛛池模板: 库车县| 沙田区| 仁寿县| 宣汉县| 衢州市| 隆德县| 赤壁市| 甘洛县| 来安县| 轮台县| 柞水县| 富锦市| 梁山县| 西充县| 阿图什市| 江源县| 阜南县| 雷山县| 黔西县| 兴海县| 太白县| 绿春县| 濮阳市| 栾川县| 诸暨市| 南通市| 古交市| 新源县| 攀枝花市| 汕头市| 宁安市| 岗巴县| 黄平县| 汉寿县| 丰原市| 西畴县| 砀山县| 元谋县| 沈阳市| 富顺县| 磴口县|