Shift() function is mostly used to remove and return the first element from an array reduces the the size of array by one. First element in a array is the lowest indexed element.While pop() removes the last element from the array, which is highest indexed.
@mynames = ("larry", "james", "peter");
$firstname = shift(@mynames);
# now $firstname will be "larry" and @mynames will be ("james", "peter").
No comments:
Post a Comment