Re: Meaning of [@tempArray]
[email protected] ("Dr.Ruud")
| Newsgroups | perl.beginners |
|---|---|
| Organization | Chaos rules. |
| Message-ID | <[email protected]> |
"Jeff Peng" schreef: > sundeep.sn@: >> What does the following piece of code mean? >> >> my @temp1; >> my @temp2; >> $cnt=0; >> $temp2[$cnt] = [@temp1]; >> >> What is the kind of data stored in $tempFieldNames[$information] ? > > [@temp1] means creating an anonymous array. It creates an anonymous array *and* returns a reference to it. > This anonymous's elements are the ones of @temp1. The elements of the anonymous array are *copies* of the ones of @temp1. > An anonymous array is a scalar, this scalar is assigned to > $temp2[$cnt]. An anonymous array is just an array with no name. A reference is a scalar. See perlref and perlreftut. -- Affijn, Ruud "Gewoon is een tijger."