Hi, I have a series of perl script each dependent on the output of the previous, some of them with command line arguments. Is there a way for this to be done in Perl so that I run the whole pipeline from one single program, keeping track of all the right imput and output files and the right command line arguments (for ex. the output of the 1st program is the command line argument of the second or sth. like that)

I have read about several ways of calling a shell command from within a perl script (system command, backticks, exec..)I tried them on a very simple program but they do not really work as I want to.

I have a program "success.pl" which only prints "Success" on the screen and another program called "program.pl" from within which I try to execute the program success.pl. I tried the following:


1. backticks
@var=`success.pl`; print @var;

Nothing is printed on the screen :(

2.system

@var=system("success.pl") or die "cant run"; print @var;
I get -1

3.open

OPEN(FH, "success.pl"); @var=<FH>; close(FH); print $var;
I get: Undefined subroutine &main::OPEN called at program.pl line 3 :(

4.exec

@var=exec ("success.pl") or die "cant run"; print @var;
I get 0
Help please!!! Thanks, Irena

In reply to Running perl script from a perl script by ikuzmanovs

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.