in reply to Re^3: return the output to the Parent script
in thread return the output to the Parent script

Yes I do.

Sorry for not giving sufficient info.
Here is my requirement.

1.Call another(child) script which process a text file and return a value to the main script.

I am calling the second script frm main like this.

 my $cmd=" perl C:\\ia\\getset_build_num.pl -mode get -p $outputname -t $build_num_template -c $build_num_config";
In the second script, I capture the cmd input,exec subroutine and return the value to the main script. Problem arises when returning the value to main script. I am wrong when returning the value. if so what will be the correct value.

if ($mode eq "get") { my ($bld_num,$message)= get_build_number($package,$config_file); return $bld_num; }else{ my ($set_status,$message) = set_build_number($package,$template,$c +onfig_file); return ($set_status,$message); }
Thanks

Replies are listed 'Best First'.
Re^5: return the output to the Parent script
by Corion (Patriarch) on Sep 22, 2008 at 10:14 UTC

    A Perl program that you call via backticks to process its output is just like any other program. It has to print the output. Using return does not work. Your child Perl program does not work alone, so it won't work when called via backticks or system either.

    If you want to structure your programs and keep common parts in a single file, look at do or require to load Perl code from files and call the common code as a subroutine.