perl add element to array
Adding an Element to an Array in Perl
To add an element to an array in Perl, you can use the push
function. Here's an example:
my @array = (1, 2, 3);
push @array, 4;
After this operation, the @array
will contain (1, 2, 3, 4)
.
[[SOURCE #1]]