How to return a value of a variable from shell script to perl script

HI ,
Is there any way to return a value of variable from shell to perl script.

Code:

Perl file
my $diff1=system("sh diff.sh");
my $diff2=system("sh diff1.sh");

I need exit status of below commands

i.e 0 and 1 respectively.

Since in both the cases diff is working so system command will return 0 .

diff1.sh
-------
a=diff aaa ccc
diff.sh
--------
b=diff aaa bbb

122 $> cat aaa
1hi hello
123 $> cat bbb
hi hello
125 $ cat ccc
1hi hello

120 $ diff aaa ccc
echo $?
0

diff aaa bbb
1c1
< 1hi hello
---
> hi hello
Exit 1

echo $?
1

If i'll use backtick it'll return the diff output like below:
1c1
< 1hi hello
---
> hi hello

But I need script to return a value like 1 if it finds any diffrence between two files and 0 if it doesnot find any diffrence between two files .

StdOut, StdErr - you can catch them.
Return code - a value which is 0 or !0. 0=SUCCESS, !0=FAILURE (according to POSIX). There are exceptions like diff. Return code should be between 0 and 127 but might be different.
There are other possibilities as well... google for inter-process communication.

Hi adderek ,
Thanks for the reply

Can you please help me to sort out this
I am running an application XXXX , and when it starts i am passing a file name called "connect.spb" and after the application connects to the server i am sending filename "accept.spb" as a parameter.

BL31DL385:$ ./XXXX

This is XXXX (Reproducer by Order or RelaY)

XXXX> @connect.spb

XXXX>Opening connect.spb

Script> SET TCPIP /LOCAL_PORT=15331
Initialised TCP Listener on BL31DL385 (port: 15331)

>@accept.spb

XXXX> Opening accept.spb

So basically Input parameters are @connect.spb and @accept.spb.
After getting first string application will connect to the client ,
Then wait for the input and when accept parameter is given communication established succesfully.

MyQuestion##can we automate this using a script which will first run the application XXXX, and then pass the connect.spb and accept.spb as input

Check "expect" utility. It should fit you.
This application XXXX seems to be something not designed for your purpose - since it lacks propper interface. Check if you can replace XXXX with something different.