View Single Post
Old 12-22-2003, 09:07 PM   #4 (permalink)
Epsilon
Regular Contributor
 
Epsilon's Avatar
 
Join Date: Mar 2003
Location: Las Vegas, NV
Posts: 127
Epsilon is on a distinguished road
$_ is a special variable that hold the value of STDIN if you don't assign STDIN to a variable.

@_ holds an array of all the values passed to a subroutine.

STDIN stands for Standard Input and it is used to get input from the keyboard (typically to prompt a user to type something). You don't have to specifically type STDIN. If you just use the angle brackets as in:
$temp = <>;
STDIN is implied as the default.

Shift returns the first value in an array and shortens the array by one element.
Code:
@arr = ('one','two','three');

$temp1 = shift(@arr);
$temp2 = shift(@arr);
$temp1 would be 'one' since that's the first element of the array. 'one' would also be removed from the array, so when we shift again, $temp2 is 'two' since that is now the first element of the array.
__________________
--Epsilon--
Epsilon is offline   Reply With Quote