Learn to record
CopyCodeThe Code is as follows :#! /Usr/bin/perl-W
Use strict;
The value of print '@ A @ B @ C @ D is 1 2 3', "\ n ";
My @ A = (1 .. 3 );
Pop (@ );
Print "\ @ A: The value is @ A. Pop removes the rightmost value of the array \ n ";
My @ B = (1 .. 3 );
Push (@ B, '4 ');
Print "\ @ B's value is @ B, and push adds a value to the rightmost of the array. \ N ";
My @ C = (1 .. 3 );
Shift @ C;
The value of print "\ @ C is @ C, and shift removes the leftmost value of the array. \ N ";
My @ d = (1 .. 3 );
Unshift (@ D, 0 );
The value of print "\ @ D is @ D, and unshift adds a value to the leftmost of the array. \ N ";
[Root @ otrs Perl] # Perl pop_push_shift_unshift.pl
@ A @ B @ C @ D is set to 1 2 3.
@ A: The value is 1 2. Pop removes the rightmost value of the array.
The value of @ B is 1 2 3 4, and push adds a value to the rightmost of the array.
The value of @ C is 2 3, and shift removes the leftmost value of the array.
The value of @ D is 0 1 2 3, and unshift adds a value to the leftmost of the array.