You seem to be subtly misinterpreting the way context works in perl. There is no such thing as "default" context for a given operation or expression. An expression is either in list, scalar, or void context depending upon how it is being used.

Furthermore, the placement of parens around an expression doesn't put that expression into list context. The only time parens determine context is when they are placed around the left side of an assignment, thereby providing list context for the right side of the assignment.

Arguments to unprototyped user subroutines are always evaluated in list context, which is what you observed in your example. However, had you prototyped your subroutine as sub _Printer ($$$$$$) { ... }, you would have seen your regex evaluated in a scalar context, regardless of whether or not there were parens around it.

Basically, no function/operator has any say as to what context its result is provided in. The causality works in the other direction. When you observed that you had to force scalar on your regex, it was not because the regex had been in list context by default, but because you were using the regex in list context.

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

In reply to (MeowChow) Re3: Passing match regexs as arguments to subroutines by MeowChow
in thread Passing match regexs as arguments to subroutines by ton

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.