I'm curious. Why are you "too lazy to put quotes around"?

Based on your post, it's obvious that you don't understand how qw() works. It is often called "quote words". It will give you a list of literal strings.

&comgetter(qw(Aardgas Goud brent olie Koper,)) will pass the list ("Aardgas", "Goud", "brent", "olie", "Koper,") into the comgetter subroutine.

tobyink's sample uses qw() which you now understand and q() which returns a literal string (although he used an alternate quoting character 'w'). &comgetter(qw(Aardgas Goud), q wbrent oliew, qw(Koper,)); is the same as writing comgetter(qw(Aardgas Goud), q(brent olie), qw(Koper,)); or even comgetter('Aardgas', 'Goud', 'brent olie', 'Koper,');.

More information is available in perlop's section on Quote and Quote-like Operators.

BTW, don't use an ampersand (&) in front of the subroutine name unless you understand what you are asking for and need it for correct functionality. As used above, you're telling Perl to call your subroutine and ignore the prototypes in place on that subroutine. Assuming this is the same comgetter subroutine you shared in a previous thread, then you don't have prototypes in place (and the name of the subroutine doesn't conflict with a built-in function) so using it is misleading to anyone who sees the code. Save using the ampersand for when you need it. See perlsub for all the details. (I know that many argue that beginners should always use it but I disagree. It just ingrains bad habits.)


In reply to Re: qw space issues by Mr. Muskrat
in thread qw space issues by robertw

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.