 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
Merging Arrays in Perl
Because an array in Perl is just a comma-separated sequence of values, you can combine them together as shown below −
Example
#!/usr/bin/perl @numbers = (1,3,(4,5,6)); print "numbers = @numbers\n";
Output
This will produce the following result −
numbers = 1 3 4 5 6
The embedded arrays just become a part of the main array as shown below −
Example
#!/usr/bin/perl @odd = (1,3,5); @even = (2, 4, 6); @numbers = (@odd, @even); print "numbers = @numbers\n";
Output
This will produce the following result −
numbers = 1 3 5 2 4 6
Advertisements
 