Ursala Luttrell wrote: > > I need to modify an existing perl script. Within the code the following > appears: > > @unique_array[12..24]= > $first_total,$second_total,$third_total,$fourth_total,undef,$fifth_total,$si > xth_total,undef,1000); > > I don't understand what the function of [12..24] is. Thanks in advance for > an explanation.
Hi Ursala. The '..' operator in Perl returns a list of values starting at the first operand and ending at the second. 12 .. 24 generates the list (12, 13, 14, 15, ..and so on.. 20, 21, 22, 23, 24) The expression @unique_array[12..24] is a "slice" consisting of the 13 elements of @unique_array with indices 12 through 24. The assignment will copy the list on the right into the array elements in the slice, but I'm not sure exactly what the code looks like as it won't even compile without an opening bracket for the list. If there really are only the nine items in the list then these will be copied to elements 12 through 20 of @unique_array. The remaning four elements in the slice will be set to 'undef'. I hope this helps. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>