#push, unshift are add multiple element in an array.
#But pop and shift are only one element is remove in an array
use strict;
use warnings;
my @array = qw(1 2 3 4 5 6 7 8);
my @insert = qw(11 12 13);
push(@array, "9", "10"); #insert in the end of an array
$, = "\n";
print @array;
print "\n\ninsert multiple element in the array\n";
unshift(@array, @insert); #insert in the start in an array
$, = "\n";
print @array;
#But pop and shift are only one element is remove in an array
use strict;
use warnings;
my @array = qw(1 2 3 4 5 6 7 8);
my @insert = qw(11 12 13);
push(@array, "9", "10"); #insert in the end of an array
$, = "\n";
print @array;
print "\n\ninsert multiple element in the array\n";
unshift(@array, @insert); #insert in the start in an array
$, = "\n";
print @array;
No comments:
Post a Comment