Re: what "shift" does, if not "$_ = shift;" ?



devphylosoff <devphyl@xxxxxxxxx> writes:

the first line in one of my subroutine is
shift;

This will just discard the first argument from @_. Not really usefull
in you functions as you don't use @_ later on.

but in this case i cannot use $_ and think $_ = shift;
why ?

If you think that 'shift' in void context is equal to '$_ = shift'
then you thinking is wrong. Why you think that I'm not able to tell,
the documentation for the shift function doesn't seem to imply this.

The documentation says that shift works on the @_ array if the
argument to shift is omitted. But it doesn't say anything about shift
doing other special things.


entire code:

If this is you entire code, then I have no idea what you expect. You
define some variables and two functions, but use neiter.

//Makholm
.



Relevant Pages

  • Re: Please can you help. I can not remember what the special formula step is.
    ... CTRL + SHIFT + ENTER ... "Rick" skrev i meddelelsen ... Now he did something that to this day I have been unable to recall or find any documentation on, I can not even remember what is did in the sheet or how it worked. ...
    (microsoft.public.excel.misc)
  • CVS: shift*(x) (was: Re: Calculating differences in data set)
    ... the demo 'running averages' ... Is there any documentation available about the shift*function? ... shift5 the only one or do other shift values exist (shift1, ...
    (comp.graphics.apps.gnuplot)
  • Re: exec command issue
    ... what does the shift mean? ... To get the documentation for the shift function. ... For the full range of what perldoc can do, go to your command prompt ...
    (comp.lang.perl.misc)
  • Re: documentation on "<<<"
    ... just waste my post unterneath ... "Dennis Sterzenbach" wrote in message ... >> Can someone point me to documentation on the <<< operator? ... > shift left means each step multiplying by 2: ...
    (php.general)
  • Re: Why references??
    ... > Looking back over the documentation of shift, it seems to me that it ... > must be the case that shift preserves the property of being an alias, ... That's certainly not explicit behaviour. ... So you can see that with shift, the variable doesn't end up as an alias ...
    (comp.lang.perl.misc)