[Kc] Scalar + Shift?

Eric eric at alliances.org
Thu Aug 3 07:44:41 PDT 2006


nah...  they're doing some shortcutting.  
my $scalar = shift;

is the same thing as saying:

my $scalar = shift @_;

Depending on the context, it could be pulling parameters off of a function call or pulling the first item off of "the current thing".

Eric

On Thu, 3 Aug 2006 09:34:05 -0500, djgoku <djgoku at gmail.com> wrote:
> So I was looking at Net::IRC irctest file which is given  as a
> "working bot" example and seen something I don't get (my $scalar =
> shift;) and haven't seen a comment explaining why this done. The only
> thing I can come up with it shifts off $scalar and makes it
> empty/"clears any value"/undef right?
> 
> Looking at more examples uses of modules on cpan.org they're are also
> shifting scalars.
> 
> perldoc -f shift #Says nothing about shifting scalar variables.
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
-- 
Eric



More information about the kc mailing list