@list Grep (Expression, @array)
@list Grep (Expression, @array)
GREP SYNTAX
PUSH SYNTAX
push(@ARRAY, VALUES);
*** Pushed Values are stores at the last of the array ***
POP SYNTAX
$scalar = pop(@ARRAY);
*** POPs the last values of the array and stores in the scalar***
SHIFT SYNTAX
$scalar = shift(@ARRAY);
*** SHIFTS THE FIRST VALUE OF THE ARRAY AND STORES IN THE
SCALAR***
UNSHIFT SYNTAX
unshift(@ARRAY, VALUES);
13) What is meant by splicing arrays explain in context of list and scalar.
Splicing an array means adding elements from a list to that array, possibly replacing
elements now in the array. In list context, the splice function returns the elements
removed from the array. In scalar context, the splice function returns the last element
removed.
The C-Style operator, ll, performs a logical (or) operation and you can use it to tie logical
clauses together, returning an overall value of true if either clause is true. This operator is
called a short-circuit operator because if the left operand is true the right operand is not
checked or evaluated.
Example :
@myNames = ('Jacob', 'Michael', 'Joshua', 'Matthew', 'Ethan',
'Andrew');
@someNames = splice(@myNames, 1, 3)