Greeting Perl Gurus!

I am having a bit of a quandary, as I am a complete Perl newbie, and the answer to my question is probably an easy one. In short, I have a c++ app that calls a Perl script from the command prompt. When we call the script, we need to specify several variables, like name and IP address, which I need to be variables that can be passed in. How can I accomplish this? I would like to continue to use the command window as it is, just somehow add the variables in place of "name" and "IPAddress". If you could, please provide a code example of what it should look like. This is just a small part that will be added to a much larger application, and this is how the architect wants it done. Any help you can give me would be awesome!!!

Thanks!

My code follows...

#include<iostream> #include<stdlib.h> #include<stdio.h> #include<string> #include<fstream> using namespace std; int main() { string fName; string lName; string IPAddress; bool created; cout << "First Name: " << endl; cin >> fName; cout << "Last Name: " << endl; cin >> lName; system("cmd.exe /C \"c:\\Program Files\\Forterra\\OLIVE SDK 2.0.1\ +\util\\legacy\\src\\Tool\\AddAvatar.pl\" --name=Bacon N Eggs --host=1 +27.0.0.1:9911"); // created = true; if (created == true) { cout << "Your Avatar's name is: " << fName << " " << lName << + endl; ofstream aviFile("aviList.txt", ios::app); aviFile << fName << " " << lName << endl; aviFile.close(); } else { cout <<"Your avatar was not able to be created or already exis +ts. Contact your system administrator"<< endl; } system("pause"); return 0; }

In reply to Passing C++ variable into Perl in command line by Kastagire

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.