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.

@unique_array[12..24] is an array slice.  A slice is a subset of an
array (or list or hash.)  The statement above is equivalent to:

$unique_array[ 12 ] = $first_total;
$unique_array[ 13 ] = $second_total;
$unique_array[ 14 ] = $third_total;
$unique_array[ 15 ] = $fourth_total;
$unique_array[ 16 ] = undef;
$unique_array[ 17 ] = $fifth_total;
$unique_array[ 18 ] = $sixth_total;
$unique_array[ 19 ] = undef;
$unique_array[ 20 ] = 1000;
$unique_array[ 21 ] = undef;
$unique_array[ 22 ] = undef;
$unique_array[ 23 ] = undef;
$unique_array[ 24 ] = undef;


Slices are described in the perldata.pod document in the section
"Slices".

perldoc perldata


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to