bagyi has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl assign scalar to array
by davido (Cardinal) on Oct 12, 2015 at 14:47 UTC | |
by ikegami (Patriarch) on Oct 14, 2015 at 19:29 UTC | |
by davido (Cardinal) on Oct 14, 2015 at 23:16 UTC | |
|
Re: Perl assign scalar to array
by Athanasius (Archbishop) on Oct 12, 2015 at 13:38 UTC | |
by ikegami (Patriarch) on Oct 14, 2015 at 19:32 UTC | |
by Athanasius (Archbishop) on Oct 15, 2015 at 06:43 UTC | |
|
Re: Perl assign scalar to array
by johngg (Canon) on Oct 12, 2015 at 14:11 UTC |