in reply to Re: My very confusing questions
in thread My very confusing questions

So, when we use shift, we're returning whatever # we want to call(In your case 5) What about the original code I posted? I use <STDIN> instead of just using a number, so would shift just shift whatever number is supplied by the user?

Replies are listed 'Best First'.
Re^3: My very confusing questions
by NetWallah (Canon) on Jul 15, 2014 at 14:23 UTC
    From "perldoc perlsub":
    Any arguments passed in show up in the array @_ . Therefore, if you called a function with two arguments, those would be stored in $_[0] and $_1 .

    From "perldoc -f shift":
    Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. If there are no elements in the array, returns the undefined value. If ARRAY is omitted, shifts the @_ array ..

    Don't use <STDIN> instead of shift(). You CAN use

    chomp(my $value = <STDIN>); # Instead of hard coding "5"
    If you want the input from the keyboard.

            Profanity is the one language all programmers know best.