Think of "use" as a function call, with specialized first argument, which is a bareword representing a name, then followed by arbitrary parameters:

use Module ( $arg1, $arg2, ... );

So now, think of this:

use Inline C;

The first argument ("Inline") is special, so that's ok, but what about the second argument, "C"? It's a bareword. That should raise the flag at which point you say, "Oh, I need to quote it!"

use Inline 'C';

Ah, but why did it work when it was

use Inline C => ...;

you say? The answer is simple. It's the same reason why the first example below works, but not the second one:

use strict; foo( FOOBAR => 'baz' ); foo( FOOBAR, 'baz' );

Yep, the "key" is automatically stringified upon encountering "=>". So when you look at the Inline example, you can clearly see that that's using this stringification trick.

Just for the record, from perlop:

The => digraph is mostly just a synonym for the comma operator. It's useful for documenting arguments that come in pairs. As of release 5.001, it also forces any word to the left of it to be interpreted as a string.

P.S. - you really should reply to the post that you refer to in your node, otherwise the poster to whom you're replying to may not notice


In reply to Re: Re: Re: Need a Help - calling C program from Perl by lestrrat
in thread Need a Help - calling C program from Perl by Anonymous Monk

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.