ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
4.9. Appending One Array to AnotherProblemYou want to join two arrays by appending all the elements of one to the end of the other. DiscussionThe @ARRAY1 = (@ARRAY1, @ARRAY2); Here's an example of @members = ("Time", "Flies"); @initiates = ("An", "Arrow"); push(@members, @initiates); # @members is now ("Time", "Flies", "An", "Arrow") If you want to insert the elements of one array into the middle of another, use the splice(@members, 2, 0, "Like", @initiates); print "@members\n"; splice(@members, 0, 1, "Fruit"); splice(@members, -2, 2, "A", "Banana"); print "@members\n"; This is output:
See AlsoThe |