LanX> when scalar is applied to a list,

Here "list" is to be read as comma separated (literal) list. (see scalar comma separator)

Sorry for nitpicking but there is too much confusion. .

What confusion where (where is the confusion)? And how is this distinction important? In this case?

I think the error message is what is confusing

$ perl -MO=Deparse -wE "say scalar('a', 'e', 'i', 'o', 'u');" Useless use of a constant ("a") in void context at -e line 1. Useless use of a constant ("e") in void context at -e line 1. Useless use of a constant ("i") in void context at -e line 1. Useless use of a constant ("o") in void context at -e line 1. BEGIN { $^W = 1; } use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch' +, 'unicode_strings', 'unicode_eval'; say scalar('???', '???', '???', '???', 'u'); -e syntax OK

Void context? scalar(...) is clearly not void :D

I think its unimportant , esp in this case, a distinction without a difference ... list literal or literal list is not even in perlglossary

A different demo of the "null list"

## a literal list in list context $ perl -le " print( qw/ a b c d / )" abcd ## a literal list in scalar context $ perl -le " print( scalar qw/ a b c d / )" d ## a literal list in lvalue list context ## a literal list in list context ( the left hand side list also hap +pens to be an lvalue) ## a literal list in list assignment (list context ) $ perl -le " print( ( $q ) = qw/ a b c d / )" a ## null list in scalar context counts, counting a list literal $ perl -le " print( $q = () = qw/ a b c d / )" 4 ## null list in scalar context counts, counting a "list" $ perl -le " @f = qw/ a b c d /; print( $q = () = @f )" 4 ## null list in scalar context counts $ perl -le " print( scalar( () = qw/ a b c d / ) )" 4 ## null list in list context discards (using literal list) $ perl -le " print( () = qw/ a b c d / )" ## null list in list context discards (the array kind of list ) $ perl -le " @f = qw/ a b c d /; print( () = @f )"

In reply to Re^3: Match operator giving unexpected output by Anonymous Monk
in thread Match operator giving unexpected output by ysreenu

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.