On Jun 12, 6:41 am, [EMAIL PROTECTED] (Rodrick Brown) wrote: > On Thu, Jun 12, 2008 at 5:28 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > Hi there, > > > I am stuck with something here. > > What does the following piece of code mean? > > > my @temp1; > > my @temp2; > > $cnt=0; > > $temp2[$cnt] = [EMAIL PROTECTED]; > > > What is the kind of data stored in $tempFieldNames[$information] ? > > Your creating a reference to an array as and storing that reference in array > index 0. > Data::Dumper can be very helpful for understanding what's going on here its > no different than doing saying $temp2[$cnt] = [EMAIL PROTECTED];
Actually, it's quite different. In the OP, $temp2[$cnt] is a reference to an anonymous array that happens to have been initialized with the data that was in @temp1 at the time it was created. In your modification, $temp2[$cnt] is a reference to @temp1. In the OP, if any following statements modify @temp1, those changes will not be reflected in @{$temp2[$cnt]}. Similarly, changes to @{$temp2[$cnt]} will not be reflected in @temp1. In your modification, changes to one will affect the other, because they're the same array. Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/