my @a; # code that init @a @a[2..5] = 2;
This assignment sets a elements at 2,3,4,5 to 2. The same works for hash slice. I would like to know if there is any documentation? And details of working. Is there any general concept behind like auto-vivification. I have looked in perl data tutorial.
Oops sorry it is not working. I didn't use strict while testing this out.In reply to Perl assign scalar to array by bagyi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |