perlreturn-valueqx

Perl -> How return value of qx(perl file)


I need to know how is possible return values of Perl file from other Perl file.

In my first file i call to the second file with sentence similar to:

$variable = qx( perl file2.pl --param1 $p1 --param2 $p2);

I have tried with exit and return to get this data but is not possible.

Any idea?


Solution

  • In file2.pl, you must print something to STDOUT. For example:

    print "abc\n";