Hi Monks,

I've got a Perl script (script1.pl) which, amoung other things, does:

  do 'script2.pl';

script1.pl is called from a web browser to create a web page.

What are my options for passing a parameter to script2.pl?

I've tried things like:

  do 'script2.pl 123';

and

  do 'script2.pl&var1=123';

but they both don't work (they don't give an error message, but script2.pl doesn't get run).

Until now, I've been working around this by doing:

  our $var1 = 123;

before the 'do' command.  Is there a better way to pass a parameter to script2.pl with 'do'?

Thanks.


In reply to do script2.pl with parms by tel2

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.