The reason for this warning is that split is creating a list in @_, and then you're evaluating that @_ array in scalar context. This has the effect of counting @_'s elements, but has the side effect of wiping out whatever happened to be in @_ beforehand. Because this is a common cause of grief for people who didn't realize they're clobbering a subroutine's parameter list, a warning is issued to alert the programmer that (s)he may be creating a hidden bug. Moreover, the entire notion of splitting into @_, because of its inherent risks, has been deprecated (discouraged... dis-recommended).
The obvious solution is to not use some contrived solution like this when Perl has a perfectly good length function. What we don't know from the code snippet you provided is if the original code actually relies on @_ containing the results of the split.
You've got one other serious problem, and that's the use of a dot (concatenation operator) where you probably intended to use a comma (list operator). Because your code has a dot where a comma belongs, Perl silently translates what you've got there into the following (use "perl -MO=Deparse scriptname.pl" if you don't believe me):
$var_cellsplit = split( ( // . $var_cellname ), $_, 0 );
Why this isn't a syntax error is a little perplexing, but the result is that your "split" regexp looks pretty funky, and instead of splitting $var_cellname, you're splitting the contents of $_. This is a BIG hidden bug.
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.