[Kc] Scalar + Shift?

Eric eric at alliances.org
Thu Aug 3 08:29:24 PDT 2006


I wouldn't be too concerned.  This particular issue is similar to something like:

my @x = split;

You just need to realize that the command doesn't make sense without an argument.  None is given, so it must be using "the current thing" - whatever that may be in the particular context.

Eric

On Thu, 3 Aug 2006 09:59:28 -0500, djgoku <djgoku at gmail.com> wrote:
> On 8/3/06, Eric <eric at alliances.org> wrote:
>> 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".
> 
> That mistake doesn't make me feel so good about what I have learned so
> far in Perl, since I am just finishing up Learning Perl 4th edition. I
> guess making mistakes makes you remember not to do that again, and
> remember there is lots of shortcuts that can be used =).
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
-- 
Eric



More information about the kc mailing list