Trying to run a perl script that uses the perl module JSON. I installed the module, but when I run the script, I get: "Can't locate JSON.pm in @INC"

When I tried re-installing the module (cpanm JSON) I get: "JSON is up to date. (2.90)"

Can someone offer some hints? I'm a compete newbie on UNIX and installing modules, so please talk in baby terms.

I understand that modules need to be in @INC, but I don't understand why it is not so automatically after a successsful installation, or how to make it so.

The line in the perl script calling JSON is this: use JSON;

If JSON.pm is not in @INC, can I specific a path in the line above to make it accessible to the script? If so, how would I go about finding that path, and what would be the format of the line in the perl script?

Thanks!

UPDATE: Guys -- Thank you for your great help. With your advice, I was able to quickly understand and solve the problem, and gain some knowledge that will help me in the future. You guys are awesome! Thanks again.


In reply to Can't locate JSON.pm in @INC by brewzzer

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.