Hi rkillera,

The $^X variable (in the first reply) displays the first word of the command line you used to start this program. If you started this program by entering its name, the name of the program appears in $^X. If you used the perl command to start this program, $^X contains perl.

The following statement checks to see whether you started this program with the command perl:

if ($^X ne "perl") { print ("You did not use the 'perl' command "); print ("to start this program.\n"); }

So the first reply might not be so useful in your case.

I dont know which platform Your working with. But in unix i usually do this way.

$path = `which perl`; print $path; /usr/bin/perl

If you want to run perl script there is also another way. Put the perl interpreter path in the first line of your program. This is called shebang ling techinically

#!/usr/bin/perl

Run the program like this.

./pgm

This will run from the interpreter you have mentioned in the first line of the program.

-Prasanna.K

In reply to Re: path to perl interpreter by kprasanna_79
in thread path to perl interpreter by rkillera

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.