enoch has asked for the wisdom of the Perl Monks concerning the following question:
Obviously, I am not making use of @_ in this split. Is perl warning because I am not assigning the return value of the split to an array? Because if I do this:print scalar((split('', "I am a string"))) . "\n";
It does not warn. I am not really worried about the warning because the output ('13' in this case) is correct. I was just wondering if this is a bug, or if this is by design. And, if it is by design, why? Or, perhaps somewhere in the parsing, perl becomes confused with the scalar call on the returned array of split. I don't know. I am just wondering. I have tried this on both perl v5.6.1 for i686-linux and ActiveState perl v5.6.0 binary build 623 and received the same warning.my @chars = split '', "I am a string"; my $num = scalar(@chars); print $num . "\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Mistakenly Believing split is using @_
by Maestro_007 (Hermit) on Sep 19, 2001 at 22:15 UTC | |
Re: Mistakenly Believing split is using @_
by japhy (Canon) on Sep 19, 2001 at 22:15 UTC | |
Re: Mistakenly Believing split is using @_
by lemming (Priest) on Sep 19, 2001 at 22:22 UTC | |
Re: Mistakenly Believing split is using @_
by Anonymous Monk on Sep 19, 2001 at 22:18 UTC | |
Re: Mistakenly Believing split is using @_
by particle (Vicar) on Sep 19, 2001 at 22:20 UTC |