- How do I append an element to a perl array?
How do I append an element to a perl array?
Use push() like this:
push(@a, 'new element');
Note that push() works in-place. So do NOT do this:
@a = push(@a, 'new element'); # WRONG, WRONG, WRONG
Copyright © 2008-2021, dave. Code samples on Dave's Brain is licensed under the
Creative Commons Attribution 2.5 License.
other material, including English text has all rights reserved.