Browse - Programming Tips - How do I append an element to a perl array?

Date: 2014nov11
Language: perl

Q.  How do I append an element to a perl array?

A.  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