Perl gives the warning:
Use of implicit split to @_ is deprecated
when used in the following code:
print scalar((split('', "I am a string"))) . "\n";
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:
my @chars = split '', "I am a string";
my $num = scalar(@chars);
print $num . "\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.
Jeremy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.