Perl get slice of array

Code examples

1
0

perl slice array

# Basic syntax:
my @array_slice = @your_array[start_index..end_index];

# Example usage:
# Define array
my @your_array = (2.3, 42, 'Word');
# Get 1st - 2nd elements (inclusive, zero-indexed)
my @array_slice = @your_array[1..2];
print "@array_slice\n";
--> 42 Word

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................