

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create Array in Perl?
<p>Perl Array variables are prefixed with the @ sign and are populated using either parentheses or the qw operator. For example −</p><pre class="result notranslate">@array = (1, 2, 'Hello'); @array = qw/This is an array/;</pre><p>The second line uses the qw// operator, which returns a list of strings, separating the delimited string by white space. In this example, this leads to a four-element array; the first element is 'this' and last (fourth) is 'array'. This means that you can use different lines as follows −</p><pre class="result notranslate">@days = qw/Monday Tuesday ... Sunday/;</pre><p>You can also populate an array by assigning each value individually as follows −</p><pre class="result notranslate">$array[0] = 'Monday'; ... $array[6] = 'Sunday';</pre>
- Related Questions & Answers
- How to create Database Connection in Perl?
- Create References in Perl
- Perl Array Variables
- Understanding Perl Array
- Array Size in Perl
- Accessing Array Elements in Perl
- Slicing Array Elements in Perl
- Replacing Array Elements in Perl
- Create, Delete and Change Directories in Perl
- Create a Report Header using Perl
- Adding and Removing Elements in Perl Array
- How to use Formats in Perl?
- How to run Perl Program?
- How to create an Array in Java?
- How to create an array in PowerShell?
Advertisements