in reply to return a value from perl script to perl module call ing the script

You can open a pipe and read from the child's output.

my $child_pid = open my $child_fh, '-|', 'perl test.pl' or die "Can't run test.pl: $!"; my $first_line_of_output = <$child_fh>; close $child_fh;

The close will wait for the child. If you want to pass back more fancy data structures, you could have the child produce Data::Dumper output which the parent would eval.

  • Comment on Re: return a value from perl script to perl module call ing the script
  • Download Code