In
digital electronics, to shift is to move all the
bits of a
register to the left (left shift) or right (right shift). The last bit in the shift direction is "
shifted out", while a new bit is supplied for the first.
Example:
----------
1 -> |01100110| ->
----------
----------
-> |10110011| -> 0
----------
See also
shift register.
Perl function:
shift @array
Removes and returns the first value of @array, moving the other elements down and reducing the length of @array by 1. If @array contains no elements, the undefined value is returned.
If no argument is given, shift affects @ARGV (in main program) or @_ (in a subroutine).
See also push, pop and unshift.
Back to Perl