So if I want the real argument count, I have to split into a temporary array first, or else use a dummy trailing array in the assignment list. Gross.

Personally i think the issue here is that what you are trying to do is much less common than the opposite. Ie, more people would rather have split// be faster on spliting a few elements out scenarios than they would with have it be slower but more consistant with other list returning functions. After all, split may be quite the wrong way to do this. Arguably

my $count=()=$argstring=~/\s+/g; my ($arg1, $arg2, $arg3) = split /\s+/, $argstring;

is better anyway, as if the $argstring is long and you only are going to store three elements then its better not do the actual splitting (creating new svs, populating them etc) when you dont need to.

---
demerphq


In reply to Re^3: List assignment in scalar context by demerphq
in thread List assignment in scalar context by Grimnebulin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.