in reply to Re^2: More intelligent warning?
in thread More intelligent warning?

Nope! I can not see any rational for that.

Hmm, well. $_ is the default "this", so @_ is the default "these". If split is called implicitly on $_, it seems somewhat logical to me to implicitly split into @_.

Bu then, the following arguably should not implicitly split into @_ :

perl -wle '$n="";$f="abc";$n=split//,$f;print for @_'

To defeat that behavior we have to use the "operator" with the disputed name...

perl -wle '$n=""; $f="abc"; $n=()=split//,$f; print for @_'

update:

That looks like coming from looong ago. Consider:

while(<>) { $n = split; warn "processing $n tokens\n"; &process; # implicitly takes @_ }
So... another reminiscence of perl4. perl4!

Replies are listed 'Best First'.
Re^4: More intelligent warning?
by BrowserUk (Patriarch) on Feb 08, 2010 at 01:26 UTC

    I don't have a problem with the implicit split to @_, when called in a void context. It wouldn't do anything useful at all otherwise.

    And the number of items produced is then readily availble as scalar @_:

    while(<>) { split; warn "processing " . @_ . " tokens\n"; &process; # implicitly takes @_ }

    Having split in a scalar context just return the count also makes sense. (To me at least.)


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.