How to merge two arrays in perl?



How to merge two arrays in perl?..

Answer / Vikul Kumar

To merge two arrays in Perl, you can use the `union` function from the List::MoreUtils module or use the `push` method to concatenate arrays. Example: my @array1 = (1, 2, 3); my @array2 = (4, 5, 6); push(@array1, @array2);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

1 Answers  


How can you create an object of a class in a package?

4 Answers   IBM,


What does perl do in linux?

1 Answers  


Explain arrays in perl.

1 Answers  


What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?

1 Answers  


Write a simple regular expression to match an IP address, e-mail address, city-state-zipcode combination.

15 Answers  


Explain lists and ivalue?

1 Answers  


How do I sort a hash by the hash value?

1 Answers  


Explain perl one-liner?

1 Answers  


We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?

1 Answers   AppLabs,


Explain different types of perl operators.

1 Answers  


Difference between Perl and Mod_perl?

2 Answers  


Categories