1

How to understand such this kind of value in Perl?

my %opt = ( _argv => join(" ",@ARGV),_cwd = cwd()).

Are _argv and _cwd both strings?

simbabque
  • 53,749
  • 8
  • 73
  • 136
winterli
  • 68
  • 6

2 Answers2

7

From the reference:

The => operator (sometimes pronounced "fat comma") is a synonym for the comma except that it causes a word on its left to be interpreted as a string if it begins with a letter or underscore and is composed only of letters, digits and underscores. This includes operands that might otherwise be interpreted as operators, constants, single number v-strings or function calls. If in doubt about this behavior, the left operand can be quoted explicitly.

my %hash = ('a' => 'b', 'c' => 'd');

can be written as

my %hash = (a => 'b', c => 'd');
Joni
  • 108,737
  • 14
  • 143
  • 193
0

thanks for everyone, Now I think _argv and _cwd both are just a variable name, equals to "_argv" and "_cwd".

winterli
  • 68
  • 6