Perl Array

[Solved] Perl Array | Perl - Code Explorer | yomemimo.com
Question : perl array

Answered by : charlesalexandre-roy

# Basic syntax:
my $array_element = $your_array[array_index];
# Note, Perl's use of sigils ($, @, %) can be a little confusing. Even though
#	your_array is an array, when accessing a single element it's essentially
#	a scalar so you use $ both for the array and the new variable
# Example usage:
# Define array
my @your_array = (2.3, 42, 'Word');
# Select 2nd element (zero-indexed)
my $array_element = $your_array[2];
print "$array_element\n";
--> Word

Source : https://www.tutorialspoint.com/perl/perl_arrays.htm | Last Update : Thu, 10 Mar 22

Question : perl array

Answered by : spotless-skunk-9s3znls36tiq

#!/usr/bin/perl
@ages = (25, 30, 40);
@names = ("John Paul", "Lisa", "Kumar");
print "\$ages[0] = $ages[0]\n";
print "\$ages[1] = $ages[1]\n";
print "\$ages[2] = $ages[2]\n";
print "\$names[0] = $names[0]\n";
print "\$names[1] = $names[1]\n";
print "\$names[2] = $names[2]\n";

Source : https://www.tutorialspoint.com/perl/perl_arrays.htm | Last Update : Tue, 21 Apr 20

Question : perl array

Answered by : spotless-skunk-9s3znls36tiq

$ages[0] = 25
$ages[1] = 30
$ages[2] = 40
$names[0] = John Paul
$names[1] = Lisa
$names[2] = Kumar

Source : https://www.tutorialspoint.com/perl/perl_arrays.htm | Last Update : Tue, 21 Apr 20

Answers related to perl array

Code Explorer Popular Question For Perl